<wanderer_>
when I don't call it, I get #[warn] evsig_init: socketpair: Successful WSAStartup not yet performed [WSANOTINITIALISED ]" after started the compiled & linked compiler, it also works
<wanderer_>
so without WSAStartup the compiled compiler can compile itself again, with it, however, I get the error from above when trying to use the new compiled compiler
<wanderer_>
for any source file
<wanderer_>
but without WSAStartup libevent shouldn't work, I don't really know, though, I've never used it before
<wanderer_>
after 0.6.1 the stdlib uses the scheduler by default, doesn't it? and the scheduler needs both libevent and libpcl?
<jhass>
afaik, yeah
<wanderer_>
ah, I know what I messed up: so far I haven't fully understood what's going on in the stdlib, so I'm sometimes using trial&error, like windows doesn't have fcntl, that's why I commented out the whole if-block in FileDescriptorIO#initialize, so it doesn't initialize @event which is why it's untyped later
<jhass>
might still be a bug
<wanderer_>
again, I don't have experience with non-blocking IO that's why I don't even know what's going on there /swt
<jhass>
me neither really
<jhass>
but yeah, an unassigned instance var should be (and typed as) nil
<jhass>
so might still be a bug
<wanderer_>
k, I'll write it down
<jhass>
>> class Foo; def a; @a; end; end; Foo.a
<DeBot>
jhass: Error in line 3: undefined method 'a' for Foo:Class
<jhass>
>> class Foo; def a; @a; end; end; Foo.new.a
<DeBot>
jhass: nil
<wanderer_>
apparently, it's a runtime error, I've changed the src and it's still raised
<wanderer_>
still reporting like 107, which is now a different one
<wanderer_>
*line..
<jhass>
well, if you modified code there's a good chance that it's reproducable on non-windows
<wanderer_>
well, now I've commented out only the fnctl-calls and it seems to work, it shouldn't be non-blocking now, though
<jhass>
mmh, nope, can still compile the compiler with a compiler compiled with it commented out
<wanderer_>
yes, but does it work again?
<wanderer_>
it's apparently a runtime error, so the freshly compiled compiler shouldn't work anymore
<wanderer_>
at least for me it did not
<jhass>
I commented it out, compiled a compiler and then compiled a compiler with the resulting compiler
<wanderer_>
ah, k
wanderer_ has quit [Ping timeout: 246 seconds]
<strcmp1>
jhass, so meta
<jhass>
self-hosted compiler correctness test: compile the new code with the old compiler, compile the new code with the new compiler, compile the new code with the compiler from the last iteration, check that the result and the compiler before that have the same checksum
<jhass>
meta enough? :P
Ven has joined #crystal-lang
a5i has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
dhruv has joined #crystal-lang
<dhruv>
hello everyone! I need to instantiate a class from a string of its qualified name, eg "Mod.Classname". Is there a way to do this?
<jhass>
no
<jhass>
except doing a manual lookup table I guess
<jhass>
but then you'll be quite limited on what you can call on the resulting object
<dhruv>
that's a shame :( Any plans for adding this feature in the future?
<jhass>
I doubt it, keep in mind that if a method call is valid is a compile time check
<jhass>
so if the compiler doesn't know which type (=class) it is, it can't validate if your call is possible
<jhass>
what do you need that for?
<dhruv>
I'm working on a web framework and needed django style routing
<dhruv>
Another quick question. can I pass functions/methods as method arguments?
<jhass>
yes
<jhass>
though you need to explicitly type them, at least on the method definition
<dhruv>
that's not a problem. What's the syntax for that?
<jhass>
and you might want to use a block instead
<jhass>
it depends a bit on what you want exactly, there are 3-4 variants
<jhass>
>> def foo; yield 1; end; foo {|i| "this is a normal block, it got the parameter #{i}" }
<DeBot>
jhass: "this is a normal block, it got the parameter 1"
<dhruv>
I need to pass a function to a class method which should be able to call it
<jhass>
>> def foo(&block Int32 -> String; block.call(1); end; foo {|i| "this captures a block into a Proc object, so you can pass it around, it got the parameter #{i}" }
<DeBot>
jhass: Syntax error in eval:3: expecting token ')', not 'Int32'
<jhass>
>> def foo(&block : Int32 -> String; block.call(1); end; foo {|i| "this captures a block into a Proc object, so you can pass it around, it got the parameter #{i}" }
<DeBot>
jhass: Syntax error in eval:3: expecting token ')', not ';'
<jhass>
eh
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<strcmp1>
missing a paren
<jhass>
>> def foo(&block : Int32 -> String); block.call(1); end; foo {|i| "this captures a block into a Proc object, so you can pass it around, it got the parameter #{i}" }
<DeBot>
jhass: "this captures a block into a Proc object, so you can pass it around, it got the parameter 1"
BlaXpirit_ has joined #crystal-lang
<jhass>
>> def foo(proc : Int32 -> String); proc.call(1); end; foo(-> (i : Int32) { "this is a Proc literal, you can pass it around, it got the parameter #{i}" }
<DeBot>
jhass: Syntax error in eval:4: expecting token ')', not 'end'
<jhass>
not my day
<jhass>
>> def foo(proc : Int32 -> String); proc.call(1); end; foo(-> (i : Int32) { "this is a Proc literal, you can pass it around, it got the parameter #{i}" })
<DeBot>
jhass: "this is a Proc literal, you can pass it around, it got the parameter 1"
<jhass>
>> def foo(fun : String ->); fun.call("this takes a pointer to a named function too"); end; foo(->puts(String))
<DeBot>
jhass: Syntax error in eval:3: can't define fun inside def
BlaXpirit has quit [Ping timeout: 246 seconds]
<jhass>
>> def foo(func : String ->); func.call("this takes a pointer to a named function too"); end; foo(->puts(String))
<DeBot>
jhass: in /usr/lib/crystal/io.cr:339: undefined method 'inspect' for Void
<jhass>
heh
<jhass>
something like that at least
<dhruv>
i get the idea. thanks
<jhass>
a nice trick is to create an alias for your function signature
<jhass>
alias MyCallback = String -> Bool; def fun(cb : MyCallback); cb.call("hey"); end
zipR4ND has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
panga has joined #crystal-lang
ponga has quit [Ping timeout: 256 seconds]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
bcardiff has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
a5i has quit [Quit: Connection closed for inactivity]
Ven has joined #crystal-lang
JBat has joined #crystal-lang
<zipR4ND>
hi, given i have a buffer (pointer) of UInt8 how can i convert this to a string converting bytes back to chars ... link String.bytes backwards ?
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass>
I wonder if we should define something like rack early on
<jhass>
oh the time..
havenwood has quit [Remote host closed the connection]
strcmp1 has joined #crystal-lang
gmathe has joined #crystal-lang
<gmathe>
hey i got a question, is crystal good to learn as a beginner programmer?
<strcmp1>
maybe not, just because there's not a whole lot of documentation and the language is still new.
<a5i>
gmathe, if you learn Ruby then you'll pick up Crystal in 1.7 seconds
<shadeslayer>
heh
<a5i>
next release of crystal will have specified return types for methods ?
havenwood has joined #crystal-lang
<jhass>
gmathe: but indeed, start with Ruby, less concepts to grasp, lots of resources oriented to programming beginners and easy to learn Crystal afterwards
vifino has joined #crystal-lang
<gmathe>
isn't ruby mostly used for web purposes
<strcmp1>
professionally, yeah
<jhass>
it's still a general purpose programming language, that just means that the ecosystem is stronger in that area
<strcmp1>
i don't do anything with web+ruby, and i still write a lot of ruby. it's not professional though, just open source hacks.
zipR4ND has quit [Ping timeout: 264 seconds]
shama has joined #crystal-lang
gmathe has quit [Remote host closed the connection]
<shadeslayer>
what
<shadeslayer>
strcmp1: I think you're juding ruby on the wrong criteria
<shadeslayer>
I use it heavily to write backend code
<shadeslayer>
nothing to do with websites, but building distributions
<strcmp1>
just speaking from personal experience, i had a few jobs doing ruby and all of 'em were web focused.
havenwood has quit [Remote host closed the connection]
<shadeslayer>
strcmp1: the ecosystem is doing lots of web stuff sure
<strcmp1>
id say the ecosystem is probably doing less web stuff overall, just that if you want to get a job doing ruby you're probably looking at using rails/some web framework.
<strcmp1>
more often than that it's rails.
<strcmp1>
i dont disagree ruby is useful beyond that tho :)
DerisiveLogic has joined #crystal-lang
dhruv has quit [Ping timeout: 256 seconds]
<ponga>
looking forward to crystal 1.0.0
<a5i>
that seems like a long way lol
BlaXpirit_ has quit [Quit: Quit Konversation]
wanderer_ has joined #crystal-lang
<strcmp1>
haha
a5i is now known as vikaton
wanderer_ has quit [Quit: Page closed]
ponga has quit [Remote host closed the connection]
shama has quit [Remote host closed the connection]