bcardiff has joined #crystal-lang
aritheory has quit [Ping timeout: 264 seconds]
dom96 has quit [Excess Flood]
dom96 has joined #crystal-lang
waj has joined #crystal-lang
waj has quit [Quit: Leaving.]
whomp has quit [Ping timeout: 245 seconds]
waj has joined #crystal-lang
emmanueloga_ is now known as emmanueloga
waj has quit [Quit: Leaving.]
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 255 seconds]
mattwiese has joined #crystal-lang
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 264 seconds]
mattwiese_ has joined #crystal-lang
mattwiese has quit [Read error: Connection reset by peer]
bcardiff has quit [Quit: Leaving.]
mattwiese_ has quit [Quit: I'm out, later guys]
mattwiese_ has joined #crystal-lang
mattwiese_ is now known as mattwiese
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
<mattwiese> Sup all
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 252 seconds]
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 240 seconds]
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 244 seconds]
mattwiese_ has joined #crystal-lang
mattwiese has quit [Ping timeout: 264 seconds]
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 255 seconds]
aritheory has joined #crystal-lang
rpag has quit [Quit: Leaving]
rpag has joined #crystal-lang
sferik has joined #crystal-lang
sferik has quit [Ping timeout: 250 seconds]
sferik has joined #crystal-lang
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sferik has joined #crystal-lang
sferik has quit [Read error: Connection reset by peer]
sferik has joined #crystal-lang
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sferik has joined #crystal-lang
sferik has quit [Read error: Connection reset by peer]
sferik has joined #crystal-lang
kostya has joined #crystal-lang
kostya has quit [Remote host closed the connection]
kostya_ has joined #crystal-lang
mattwiese_ has quit [Read error: Connection reset by peer]
mverzilli has joined #crystal-lang
mverzilli has quit [Ping timeout: 245 seconds]
sferik has quit [Read error: Connection reset by peer]
sferik has joined #crystal-lang
waj has joined #crystal-lang
asterite has joined #crystal-lang
bcardiff has joined #crystal-lang
<asterite> About your other questions, I suggest to create github issues to discuss them (like the restriction on splats). Here it’s hard to follow, specially if there are many topics at the same time
<asterite> Plus, it gets kind of lost in time
<asterite> sferik: not that I didn’t want you to implement Iterator/Enumerator, it’s just that I had it already but we never pushed it because @waj wants to do something like what C# does with yield return (but I think that’s a lot of work, and maybe it’s not that hard to write iterators manually)
<kostya_> for me this 7.5 times slower
<asterite> kostya: with times.map ?
<kostya_> yes
<asterite> Really? Compiled with release?
<asterite> That’s very, very strange
<kostya_> crystal array_new_vs_int_times_map.cr --release user system total real Array#new 0.000290 0.000015 0.000305 ( 0.136604) times#map 0.001404 0.000519 0.001923 ( 1.015741)
<asterite> Hmm… I tried it in a linux vm and for me it’s 5.3 times slower
<asterite> I wonder if it depends on some llvm optimizations for that platform
<asterite> Very strange
<asterite> In any case it’ll always be slower than Array#new :(
<asterite> I’d really like to try this in Rust, see if they somehow managed to make both methods have the same efficiency
<asterite> (but I don’t know if there’s an Array#new with block equivalent in Rust)
<sferik> asterite: thanks for looking into this
<asterite> kostya: if you do that benchmark in Ruby, what are the timings?
<sferik> asterite: I’d encourage you to publish some of these Gists as blog posts
<sferik> asterite: and discuss why Crystal has chosen not to implement some of these methods yet
<sferik> asterite: I think it's very good for the project to say, "we could implement this but we have decided not to, for this and this reason"
<sferik> asterite: or "we've decided to implement it differently, for this and this reason"
<sferik> asterite: otherwise, people may assume it's missing because you haven't had time to implement it yet
<sferik> asterite: what do you think about each_slice vs. in_groups_of vs. in_groups?
<asterite> They are useful, it’d be good to have them
<sferik> asterite: all three of them?
<asterite> Maybe each_slice could be confused with the Slice class
<sferik> asterite: right, I think I made that point yesterday
<asterite> But… Slice is used at the very low level, so most people won’t know about it
<sferik> asterite: okay
<asterite> so I don’t mind naming it each_slice
<sferik> asterite: alternatively, I could just implement in_groups_of
<asterite> They are the same?
<sferik> asterite: which does basically the same thing as each_slide
<sferik> *each_slice
<sferik> asterite: very similar
<asterite> The difference seems to be the “fill_with”, right?
<sferik> asterite: for some reason, in_groups_of is implemented on Array instead of Enumerable
<sferik> asterite: in Ruby, each_slice can be called on any Enumerable, which I think is preferable
<asterite> Strange
<asterite> Yes
<asterite> in_groups_of is implemented using each_slice, which is even stranger
<sferik> asterite: for example (1..6).in_groups_of(2)
<asterite> I don’t think those methods are very efficiet
<asterite> their implementaiton, I mean, not that they can’t be implemented more efficiently :)
<sferik> asterite: what do you mean?
<sferik> asterite: never mind. I understand.
<asterite> There’s dup, concat, each_slice, to_a
<asterite> I don’t know why all of that is needed
<sferik> asterite: right
<sferik> asterite: I will open an issue about typed splats
<asterite> Good. I’m very curious about why you need that
<sferik> asterite: I just want to be able to do dynamic dispatch across different splat methods
<sferik> asterite: and ensure type safety
<asterite> Ok. Just note that dispatch over a union of splats doesn’t work right now: https://github.com/manastech/crystal/issues/223
<asterite> And won’t... for some time
<sferik> asterite: as I mentioned, it's not urgent
<sferik> asterite: I'm okay with using arrays instead of splats, for now
<asterite> I’m sure we’ll have that, eventually
<asterite> The “problem” with splats and tuples is that there’s no way right now to say “a tuple of any length, but all of them ints”
<sferik> asterite: I guess my question is, it is possible to make (*args of Int32) syntatic sugar for (args of Array(Int32))?
<sferik> asterite: that lets you pass arguments into the function without the square braces
<sferik> e.g foo(1, 2, 3) instead of foo([1, 2, 3])
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sferik has joined #crystal-lang
<asterite> sferik: you can always define a method that takes the tuple as a splat and pass it to another using .to_a
<asterite> We could add support for that in the language
<asterite> I just never used it (maybe I don’t use too much magic in ruby)
<asterite> What’s the specific example you are trying to do?
<sferik> def foo(*args of Int32)
<sferik> def foo(*args of String)
<sferik> foo(1, 2, 3) # dispatches to the first one
<asterite> Yes, but why you need that?
<asterite> Instead of “foo”, what’s the real function?
<sferik> foo("a", "b", "c") # dispatches to the second one
<asterite> I need real use cases :)
<sferik> for example, def find_users
<sferik> I might want to find by numeric ID or username
<sferik> obviously, I could define two separate methods
<sferik> find_users_by_id
<sferik> find_users_by_username
<asterite> What about: find_users(1, “sferik”) ?
<asterite> Would that work?
<sferik> asterite: no
<sferik> that should fail with a type error
<sferik> so maybe splat is not the right thing?
<sferik> but I have this idea of a "typed splat"
<sferik> "any number of ints"
<asterite> Yes, that could work
<asterite> But… why can’t I find a user with id 1 and another with username sferik?
<sferik> asterite: you could, I suppose
<sferik> asterite: the Ruby version allows you to do this
<sferik> asterite: but in practice, people usually do one or the other
<sferik> asterite: it would be quite unusually to have a mixed list of IDs and usernames to fetch
<sferik> asterite: and this is the method that takes the splat and calls merge_users: https://github.com/sferik/twitter/blob/798f0244f99d306c320890844e8cf966f382129c/lib/twitter/rest/users.rb#L210-L227
<asterite> I think right now you can do the same in Crystal, kind of, iterating the tuple or the array and checking types at runtime (the check will probably be gone because the compiler knows the types)
<asterite> Sorry, gotta work now :)
<asterite> But please create an issue if you want to discuss this further (we are very open to enhancements and changes)
<sferik> asterite: I'm writing it up now
<sferik> asterite: thanks for your feedback
<asterite> Thank you :)
asterite has quit [Quit: asterite]
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sferik has joined #crystal-lang
asterite has joined #crystal-lang
asterite has quit [Client Quit]
shama has joined #crystal-lang
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sferik has joined #crystal-lang
kostya_ has quit [Remote host closed the connection]
aritheory has quit [Ping timeout: 264 seconds]
sferik has quit [Read error: Connection reset by peer]
sferik_ has joined #crystal-lang
sferik_ has quit [Read error: Connection reset by peer]
sferik has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1705 (master - b2f6acf : Ary Borenszweig): The build was broken.
travis-ci has left #crystal-lang [#crystal-lang]
sferik has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bcardiff has quit [Quit: Leaving.]
waj has quit [Quit: Leaving.]
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1706 (master - 2d6e798 : Ary Borenszweig): The build is still failing.
travis-ci has left #crystal-lang [#crystal-lang]
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1707 (master - e6d6446 : Ary Borenszweig): The build is still failing.
travis-ci has left #crystal-lang [#crystal-lang]
travis-ci has joined #crystal-lang
<travis-ci> manastech/crystal#1708 (master - 4cb1848 : Ary Borenszweig): The build was fixed.
travis-ci has left #crystal-lang [#crystal-lang]
<Cassyblanca> Hrm...
<Cassyblanca> Are the docs incorrect for lib at the moment? I'm getting a syntax error on ( with lib LibSDL("SDL")
<Cassyblanca> Ah, looks like that was changed to attributes, just found the sample.