<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>
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
<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'
<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>
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