asterite changed the topic of #crystal-lang to: #crystal-lang The Crystal programming language | http://crystal-lang.org | Crystal 0.6.1 | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal - Docs: http://crystal-lang.org/docs/ - API: http://crystal-lang.org/api/ - Logs: http://irclog.whitequark.org/crystal-lang
havenwood has quit []
waterlink has quit [Ping timeout: 240 seconds]
havenwood has joined #crystal-lang
ponga has joined #crystal-lang
colorisco has joined #crystal-lang
DerisiveLogic has quit [Ping timeout: 248 seconds]
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
havenwood has quit []
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
bcardiff has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
canhtak has joined #crystal-lang
JBat has joined #crystal-lang
canhtak has quit [Client Quit]
canhtak has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
ponga has quit [Remote host closed the connection]
ponga has joined #crystal-lang
leafybasil has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
canhtak has quit [Quit: canhtak]
Ven has joined #crystal-lang
Ven has quit [Client Quit]
ponga has quit [Write error: Broken pipe]
canhtak has joined #crystal-lang
ponga has joined #crystal-lang
nulpunkt has left #crystal-lang [#crystal-lang]
ponga has quit [Remote host closed the connection]
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
Ven has joined #crystal-lang
ponga has joined #crystal-lang
canhtak has quit [Quit: canhtak]
canhtak has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ismaelga has joined #crystal-lang
Ven has joined #crystal-lang
<a5i> >> x = -> {|x,y| x+y }; x(3,4)
<DeBot> a5i: Syntax error in eval:3: unexpected token: |
<a5i> >> x = Proc.new {|x,y| return x+y }; x.call(3,4)
<DeBot> a5i: Error in line 3: wrong number of arguments for 'Proc(T):Class#new' (0 for 2)
<a5i> ??
<a5i> >> x = Proc.new {|name| return name }; x.call("hi")
<DeBot> a5i: Error in line 3: wrong number of arguments for 'Proc(T):Class#new' (0 for 2)
<jhass> same as in Ruby
<jhass> >> -> (x, y) { x+y }; x.call(3,4)
<DeBot> jhass: Error function argument 'x' must have a type
<jhass> well, almost :P
<jhass> >> -> (x : Int, y : Int) { x+y }; x.call(3,4)
<DeBot> jhass: Error in line 3: undefined local variable or method 'x'
<jhass> >> x = -> (x : Int, y : Int) { x+y }; x.call(3,4)
<DeBot> jhass: 7
<a5i> -> is both lambda and Proc ?
<a5i> They are bascially the same in Ruby
<a5i> >> x = -> (x,y) { x+y }; x.call(3,4)
<DeBot> a5i: Error function argument 'x' must have a type
<a5i> ok
<a5i> Does Crystal have something similar to http://doc.rust-lang.org/nightly/book/traits.html ?
<a5i> wait, nvm
asterite has joined #crystal-lang
sadin has joined #crystal-lang
weskinner_work has joined #crystal-lang
Arrrrrr has joined #crystal-lang
Ven has quit [Ping timeout: 254 seconds]
BlaXpirit has joined #crystal-lang
<Arrrrrr> !eval p "/kick a5i"
<Arrrrrr> is not working
<a5i> for this bot, its >>
<Arrrrrr> >>eval p "/kick a5i"
<DeBot> Arrrrrr: Error in line 3: undefined method 'eval'
<a5i> I thought you meant my bot, and with this bot you dont have to put "puts"
<a5i> >> "hi"
<DeBot> a5i: "hi"
<Arrrrrr> >> "/kick a5i"
<DeBot> Arrrrrr: "/kick a5i"
<a5i> :P
<a5i> ES6 arrow functions are the same as crystal lambdas/procs
sadin has quit []
asterite has quit [Ping timeout: 246 seconds]
Ven has joined #crystal-lang
<BlaXpirit> So I just read what documentation there is, and I was blown away
<BlaXpirit> now what?
Ven has quit [Client Quit]
<a5i> BlaXpirit: now what with what? the devs are going to continue developing (non-blocking IO and lightweight processes in the next release)
<BlaXpirit> i am clueless what I can do with the language
<BlaXpirit> except for helloworlds
<jhass> BlaXpirit: poke at it, uncover bugs, contribute to docs, contribute to stdlib, write a binding for something cool
<a5i> Well that's up to you, think of an idea would have for lets say Nim, and do it in crystal if you want
<jhass> help writing a decent package manager
<BlaXpirit> writing a binding is the only thing that i can think of because i don't see any introduction to standard library
<jhass> yeah, I usually combine contributing to stdlib with something else
<jhass> I code something, find something missing, monkey patch it and later upstream the monkeypatch
bcardiff has quit [Quit: Leaving.]
<BlaXpirit> no, you don't understand.
<BlaXpirit> i don't know how to even write something to the screen
<BlaXpirit> actually, that one I could guess by looking above in this chat
<a5i> BlaXpirit: So the issue isnt with no ideas, but lack of docs ?
<BlaXpirit> yes
<a5i> ohhh
<BlaXpirit> i should've been clear about that
<jhass> oh, mh
<jhass> do you know ruby?
<a5i> Ruby is the best way to know Crystal inside and out, since they are practically but not literally the same
<a5i> I sya about 89% is actual Ruby
<BlaXpirit> do not know ruby :|
<a5i> You know Nim, Ruby will be a breeze
<a5i> #ruby is and this chat room will always be available to help !
<jhass> BlaXpirit: http://tryruby.org should get you a general feel for where to start poking in both, crystal and ruby
<BlaXpirit> so how does one wrap C "long" type?
<BlaXpirit> I am aware of this
<BlaXpirit> so what now?
<a5i> BlaXpirit: with your issue, learn some ruby then start creating things :P
<BlaXpirit> i have learned "some" ruby, just never used it
<jhass> so a 32 bit integer, Int32
<BlaXpirit> it is not a 32 bit integer
<BlaXpirit> 64 bit on my system
<BlaXpirit> 32 bit on win32
Ven has joined #crystal-lang
<jhass> well, that's why we need ifdef to decide then ;)
<BlaXpirit> ifdef what
<BlaXpirit> this is ridiculous
<jhass> ifdef windows ifdef linux
<BlaXpirit> well it is 32 bit on 32 linux
<BlaXpirit> your move?
<BlaXpirit> does Crystal have any game/multimedia library?
<jhass> looks like its mapped to Int64 in stdlib
<jhass> there are some initial bindings to SDL
<BlaXpirit> well looks like stdlib works only on 64 bit linux then
<jhass> >> "134".to_i
<DeBot> jhass: 134
<jhass> ^ that system is 32 bit
<jhass> >> "134".to_i64
<DeBot> jhass: 134
<jhass> https://github.com/weskinner/crystal-tetris here's an SDL tetris for example
<BlaXpirit> well in this case the stack is organized the same
<BlaXpirit> ok, that tetris kinda works
<jhass> the ecosystem is only developing since like 3-4 months
<jhass> it's still all very young
<jhass> and all hobbyism
asterite has joined #crystal-lang
<Arrrrrr> jhass: are you a main developer?
<jhass> no, I wouldn't say so
<Arrrrrr> Well, a contributor then?
<jhass> I don't have commit access if that counts anything
<Arrrrrr> Do you know what is the current state of the windows compiler bin?
bcardiff has joined #crystal-lang
<jhass> I think wanderer got it to compile the compiler on windows
<a5i> ooo
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JBat has quit [Ping timeout: 245 seconds]
JBat has joined #crystal-lang
<BlaXpirit> Looking to find out why this does not work. https://gist.github.com/80ddecb583bf4833c127
<BlaXpirit> C program does, attempted translation doesn't
<jhass> style is an UInt32, but not sure if that would cause the segfault, probably not
<asterite> It doesn't work because the C API uses structs as arguments, and that doesn't work well right now :(
<jhass> ah right, we had that recently
<BlaXpirit> >_>
<asterite> We'll do it, but it's a PITA
havenwood has joined #crystal-lang
<asterite> We use LLVM so it abstracts things for us, but it seems we need to do this as clang and rustc and who knows how many other compilers do it :(
<a5i> persevere !
<asterite> Like, in the case of sfWindow_create I can see the struct, which has 3 ints, is passed as *two* arguments: one i64 and one i32
<BlaXpirit> i was gonna make a lib like https://github.com/blaxpirit/nim-csfml
<BlaXpirit> which is basically a game library that i like more than sdl
<asterite> You'll have to wait until we fix that, I guess... For Nim it's easier because they generate C and compile it with a C compiler, so that's already taken care
<asterite> Awesom! As I say in that thread, I'd love to see some games written in Crystal
<asterite> I'll try to tackle this C ABI thing next, it seems like many APIs will need this
<a5i> BlaXpirit: Nice to see you picking up on Crystal, I'm interested to see what libraries you can create with it since most of your Nim projects are pretty nice
<BlaXpirit> well apparently i can't create any libs
<Arrrrrr> lol
<a5i> *when you can :P
<BlaXpirit> lol i thought i could just unwrap the struct into 3 arguments but that's not how things work
<a5i> >> rand(6)
<DeBot> a5i: 5
<BlaXpirit> >> rand(6)
<DeBot> BlaXpirit: 3
<Arrrrrr> >> rand -3
<DeBot> Arrrrrr: ArgumentError: incorrect rand value: -3
<Arrrrrr> rand 1 5
<Arrrrrr> >> rand 1 5
<DeBot> Arrrrrr: Syntax error in eval:3: unexpected token: 5
<jhass> I mean one could write a thin C wrapper that doesn't take structs but pointers to it or whatever, but that's of course insane and only a workaround until passing structs is fixed
<a5i> Arrrrrr: parenthesis
<Arrrrrr> >> rand (1 5)
<DeBot> Arrrrrr: Syntax error in eval:3: unexpected token: 5
<Arrrrrr> >> rand (1, 5)
<DeBot> Arrrrrr: Syntax error in eval:3: unterminated parenthesized expression
<BlaXpirit> at least this thing crystal got right
<BlaXpirit> mersenne, not rand()%n
<jhass> >> rand 1..5
<DeBot> jhass: 1
<a5i> or that...
canhtak has quit [Quit: canhtak]
<Arrrrrr> novist would like that
<Arrrrrr> >> rand 1..6
<DeBot> Arrrrrr: 4
<Arrrrrr> >> rand 1...6
<DeBot> Arrrrrr: 1
<jhass> >> Array.new(5) {|i| rand 0..i }
<DeBot> jhass: [0, 1, 0, 2, 3]
<BlaXpirit> >> Array.new(2) {|i| rand 0..1 }
<DeBot> BlaXpirit: [1, 0]
<Arrrrrr> Array new 2 |i| rand 0..i
<Arrrrrr> >> Array new 2 |i| rand 0..i
<DeBot> Arrrrrr: Syntax error in eval:3: unexpected token: new
<Arrrrrr> >> Array.new 2 |i| rand 0..i
<DeBot> Arrrrrr: Error in line 3: undefined local variable or method 'i'
<jhass> block delimiter are not optional
<jhass> >> Array.new 10, &.even?
<DeBot> jhass: [true, false, true, false, true, false, true, false, true, false]
<a5i> >> x = -> (x : Int,y : Int) { x+y }; x.call(3,4)
<DeBot> a5i: 7
<jhass> oh, I broke it
<jhass> >> Array.new 5, &->rand
<DeBot> jhass: Failed to run your code, sorry!
<a5i> >> "hi"
<DeBot> a5i: "hi"
<a5i> what do you mean?
<asterite> >> Array.new 5, &->rand(Int32)
<DeBot> asterite: Failed to run your code, sorry!
<jhass> yup, segfaults too
<a5i> who is bcardiff ?
<a5i> I havent seen him speak at all
<asterite> Segfaults on compile, interesting... a new bug :)
<asterite> looks like a stack overflow
<asterite> I have seen bcardiff speak (personally)
<jhass> hehe
<a5i> Im gonna write a brainfuck interpreter
<jhass> :P
<a5i> I dont wann see
<jhass> k, then just don't click
<a5i> not yet anyway :P
<jhass> how about a whitespace interpreter?
<asterite> How about a crystal interpreter?
<a5i> of only I can recreate Ruby
<a5i> if*
asterite has quit [Ping timeout: 246 seconds]
shama has joined #crystal-lang
DerisiveLogic has joined #crystal-lang
<a5i> Is there like a project style guide ?
<a5i> Like Rust has cargo new and generates a project skeleton
<BlaXpirit> i wonder what is a good way to get notified when C API structs get fixed
<BlaXpirit> oh i know. subscribe to some github issue, if there are any
asterite has joined #crystal-lang
<asterite> BlaXpirit: it's a good idea. I was going to suggest subscribing to the blog's rss, I usually write a post after a new release, but I'll add that issue now
<BlaXpirit> regex is just wrapper for PCRE match, nothing else?
<jhass> yeah
<jhass> returns you a MatchData which wraps you the match
<BlaXpirit> https://github.com/flaviut/nre would be a nice API to copy, if someone wants to work on regex
<BlaXpirit> which I might, but for now I do not want to invest in the language
<BlaXpirit> thanks, asterite. I say goodbye until that issue is fixed.
<a5i> The next release is going to be very fun :P
BlaXpirit has left #crystal-lang ["Quit Konversation"]
ponga has quit [Quit: Leaving...]
<a5i> Is getting user-input in Crystal the same as Ruby? "gets.chomp" ?
<jhass> sort of, gets may return nil, so you can't call .chomp directly
<jhass> gets.try &.chomp
<asterite> There's also read_line, but that's only in HEAD, I think
<a5i> I want HEAD to be released already :P
canhtak has joined #crystal-lang
<asterite> Me too...
Ven has joined #crystal-lang
* jhass wants a working IO.select first so he doesn't have to rewrite the IO part of his bot :P
<asterite> Maybe jhass wouldn't need to use IO.select if he has non-blocking IO, coroutines and channels :-P
<asterite> (but I really don't know)
<jhass> yeah, I'm way to lazy for that :P
<jhass> too, even
<jhass> I still ponder crystal-posix-io btw
<jhass> I think having the option to write programs that do IO and do not depend on libpcl and libevent would be quite nice :P
<a5i> difference between Goroutines and coroutines ?
Arrrrrr has left #crystal-lang [#crystal-lang]
leafybas_ has joined #crystal-lang
leafybas_ has quit [Remote host closed the connection]
leafybasil has quit [Ping timeout: 250 seconds]
canhtak has quit [Quit: canhtak]
<asterite> jhass: yes... well, initiallly we though about having two modes, but it's simpler if there's only one. Eventually we can make our own customized libevent/libpcl... in fact waj wants to do some inline assembly to implement some of that
<asterite> a5i: goroutines are couroutines in go
<jhass> asterite: as said in the past, I have no issue with a small and focused stdlib and libraries instead, I prefer that in fact
<jhass> I do not want to decide betwee Evented::IO and Posix::IO everytime I do something, I want a reasonable default
<asterite> I think the reasonable default is evented, because it's geared towards concurrency
<jhass> as such I like the movement that gemyfies large parts of Ruby's stdlib
<asterite> Or, mmm... "easy" concurrency
<jhass> I'm just saying that a reasonable default doesn't have to exclude choice, I'm all happy with deps do github "whoever/crystal-posix-io"; end
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<asterite> jhass: Ah, ok :)
DerisiveLogic has quit [Remote host closed the connection]
<jhass> mh, I wonder
<jhass> >> class Foo; def initialize; puts "a"; end; end; module Bar; class Foo; def initialize; puts "b"; end; end; end; include Bar; Foo.new
<DeBot> jhass: a
<jhass> I kinda expected that to crash :P
<a5i> o hm
<asterite> Curiously, it works exactly like in Ruby :-P
barosl has joined #crystal-lang
<jhass> >> module Bar; class Foo; def initialize; puts "b"; end; end; end; include Bar; Foo.new
<DeBot> jhass: b
sadin has joined #crystal-lang
leafybasil has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
asterite has quit [Ping timeout: 246 seconds]
BlaXpirit has joined #crystal-lang
DerisiveLogic has joined #crystal-lang
sadin has quit [Remote host closed the connection]
<a5i> finished bf interpreter
waterlink has joined #crystal-lang
Ven has joined #crystal-lang
waterlink has quit [Ping timeout: 256 seconds]
<barosl> "A language is only complete when a bf interpreter is implemented in the language"
<a5i> heh, I'm not the first
<barosl> Oops
<jhass> barosl: we actually have two in the samples :P
<barosl> A normal one and a LLVM one... Great
<barosl> Is the latter faster?
DerisiveLogic has quit [Read error: Connection reset by peer]
<jhass> probably, especially if you enable LLVMs optimizer
<a5i> Can someone give me a Brainfuck snippet I can use to test other than Hello World ?
<jhass> the LLVM one compiles the brainfuck program to a binary
DerisiveLogic has joined #crystal-lang
waterlink has joined #crystal-lang
<waterlink> DeBot: class View; @@views = [] of self.class; end
<waterlink> >> class View; @@views = [] of self.class; end
<DeBot> waterlink: Failed to run your code, sorry!
<waterlink> >> class View; @@views = [] of View.class; end
<DeBot> waterlink: nil
<waterlink> sounds like a compiler bug, first example with `self.class` should worked, because `View` and `self` are the same in this case
<jhass> hehe, class level self is all magic and trickery
<waterlink> >> class View; self; end
<DeBot> waterlink: nil
<waterlink> class View; self.class; end
<waterlink> >> class View; self.class; end
<DeBot> waterlink: nil
<jhass> >> class View; p self; end;
<DeBot> jhass: View
canhtak has joined #crystal-lang
<waterlink> >> class View; p self.class; end
<DeBot> waterlink: Class
<jhass> >> class View; p self.class; end;
<DeBot> jhass: Class
JBat has quit [Quit: Computer has gone to sleep.]
<jhass> thing is, [] of self.class needs to be interpreted by the compiler, not just transformed into code
<waterlink> >> class View; p View.class; end
<DeBot> waterlink: Class
<jhass> that's the diff where much of the magic comes in
<jhass> >> class View; p [self.class].class; end;
<DeBot> jhass: Array(Object+:Class)
<jhass> see, it's not even typed correctly there
<waterlink> >> class View; p View.class == self.class; end
<DeBot> waterlink: true
<waterlink> at least this is true )
<jhass> yeah, runtime again
<waterlink> Should I file an issue, or everybody aware of this problem? Is it a problem at all?
<jhass> always file an issue, we can always close it as a dupe or won't fix
colorisco has quit [Quit: colorisco]
DerisiveLogic has quit [Remote host closed the connection]
sadin has joined #crystal-lang
canhtak has quit [Quit: canhtak]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bcardiff has quit [Quit: Leaving.]
DerisiveLogic has joined #crystal-lang
havenwood has quit []
havenwood has joined #crystal-lang
DerisiveLogic has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite closed pull request #534: [crystal] add init command (master...crystal_init) http://git.io/vvm3E
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/vvn1E
<crystal-gh> crystal/master a11881f Ary Borenszweig: Fixed: `foo &->bar` crashed the compiler when foo didn't capture the block
<crystal-gh> crystal/master 04a37c8 Ary Borenszweig: Merge branch 'master' of github.com:manastech/crystal
<crystal-gh> crystal/master 35e4ecc Ary Borenszweig: Fixed #537: `self` as type var in class body didn't work
weskinner_work has quit [Ping timeout: 248 seconds]
ismaelga has joined #crystal-lang
weskinner_work has joined #crystal-lang
<a5i> we are missing a twitter page !
ismaelga has quit [Ping timeout: 250 seconds]
ismaelga has joined #crystal-lang
bcardiff has joined #crystal-lang
waterlink has quit [Ping timeout: 240 seconds]