asterite changed the topic of #crystal-lang to: #crystal-lang The Crystal programming language | http://crystal-lang.org | Crystal 0.6.0 | 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
havenn has joined #crystal-lang
havenwood has quit [Ping timeout: 272 seconds]
weskinner_mac has joined #crystal-lang
weskinner_mac has quit [Quit: weskinner_mac]
waj has joined #crystal-lang
weskinner_work has joined #crystal-lang
weskinner_work has quit [Ping timeout: 264 seconds]
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
weskinner_mac has joined #crystal-lang
shama has quit [Remote host closed the connection]
weskinner_mac has quit [Quit: weskinner_mac]
<crystal-gh> [crystal] waj pushed 1 new commit to master: http://git.io/pgJJ
<crystal-gh> crystal/master e62f7ca Juan Wajnerman: Dockerfile installs libevent and libpcl
<travis-ci> manastech/crystal#2108 (master - e62f7ca : Juan Wajnerman): The build passed.
ponga has quit [Remote host closed the connection]
<jhass> waj: so will libevent become a required dependency in the next release or will it retain -Devented and be optional?
<waj> yes, libevent will be required
<waj> the "evented" flag is not used anymore
<waj> no more ifdef's ;)
<jhass> libpcl will become a hard dept too then I guess?
<jhass> no longer optional?
<waj> that's correct
<waj> both libraries could be replaced with pure crystal implementations in the future
<waj> specially libpcl which I found far from ideal performance
<waj> but it's good enough at the moment
<jhass> k, thanks
<crystal-gh> [crystal] waj pushed 2 new commits to master: http://git.io/pgI2
<crystal-gh> crystal/master c4e012b Juan Wajnerman: Cleanup Fiber class
<crystal-gh> crystal/master 51694a3 Juan Wajnerman: Deleted old evented_io
waj has quit [Quit: Leaving.]
<travis-ci> manastech/crystal#2109 (master - 51694a3 : Juan Wajnerman): The build passed.
ismaelga has joined #crystal-lang
ponga has joined #crystal-lang
ponga has quit [Ping timeout: 245 seconds]
<crystal-gh> [crystal] havenwood opened pull request #472: Added Enumerable#each_slice (master...each_slice) http://git.io/pggM
havenn has quit [Remote host closed the connection]
havenwood has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
ismaelga has quit [Ping timeout: 246 seconds]
ponga has joined #crystal-lang
ponga has quit [Ping timeout: 252 seconds]
ponga has joined #crystal-lang
<crystal-gh> [crystal] Exilor opened pull request #473: Added specs for SimpleHash (master...patch-3) http://git.io/p2lN
weskinner_work has joined #crystal-lang
leafybas_ has joined #crystal-lang
leafybasil has quit [Ping timeout: 240 seconds]
weskinner_work has quit [Ping timeout: 245 seconds]
havenwood has quit [Remote host closed the connection]
leafybas_ has quit [Ping timeout: 252 seconds]
Ven has joined #crystal-lang
Ven_ has joined #crystal-lang
Ven has quit [Ping timeout: 244 seconds]
leafybasil has joined #crystal-lang
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
waj has joined #crystal-lang
weskinner_work has joined #crystal-lang
waj has quit [Quit: Leaving.]
weskinner_work has quit [Ping timeout: 240 seconds]
weskinner_mac has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
weskinner_mac has quit [Quit: weskinner_mac]
bcardiff has joined #crystal-lang
Ven has joined #crystal-lang
bcardiff has quit [Ping timeout: 240 seconds]
Ven has quit [Ping timeout: 256 seconds]
waj has joined #crystal-lang
Ven has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/paS5
<crystal-gh> crystal/master c349cce Ary Borenszweig: Document Object#dup, Object#clone, Array#dup and Array#clone
ismaelga has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/paQp
<crystal-gh> crystal/master ae0d07b Jacob: Added SimpleHash#to_s
<crystal-gh> crystal/master e36387c Ary Borenszweig: Merge pull request #471 from Exilor/patch-2...
asterite has joined #crystal-lang
weskinner_work has joined #crystal-lang
knoopx has joined #crystal-lang
<travis-ci> manastech/crystal#2113 (master - c349cce : Ary Borenszweig): The build passed.
<jhass> asterite: mmh, I'm not sure if Object#clone returning self isn't a bit unexpected
<asterite> I know. Reference and Value implemented clone like that, I just moved it to Object
<asterite> However, Array#clone is implemented by cloning each of its elements
<jhass> for Value it makes sense I guess, but for Reference it didn't make sense either IMO
<asterite> this works for every value, even primitive values, because their clone method just return the same object
<asterite> Ah, I see…
<asterite> So you don't accidentally "clone" an object without actually cloning it?
<jhass> yeah
<asterite> Makes total sense
<asterite> We can make it abstract in Object and implement it in the primitives
<asterite> because for custom structs you'd also want to have a custom clone
<jhass> mmh
<jhass> I wonder if allocating a new object and copying the instance variables for a Reference is impossible though
<jhass> maybe with a macro def?
<asterite> I think that should be possible
<asterite> Right now we have foo.@bar to access an instance variable of an object
<jhass> oh, we do? :D
<jhass> that's like a private method then?
<asterite> That breaks encapsulation, but it's very convenient for meta-programming
weskinner_work has quit [Ping timeout: 272 seconds]
<asterite> Well, I think it should only work as a private method, yet, but right now that's not enforced
knoopx has quit [Ping timeout: 245 seconds]
<asterite> So we could have foo.@bar = ...
<jhass> ugh
<jhass> :P
<asterite> and then clone would be: x = allocate; x.@foo = …; x.@bar = ...
<asterite> Don't worry, it's simple to add that check :)
<travis-ci> manastech/crystal#2114 (master - e36387c : Ary Borenszweig): The build passed.
<jhass> let's decide to leave it undocumented until it's private :P
<asterite> Of course, clone that way would be "unsafe", but it won't if it covers all instance variables, which it will
<jhass> yeah
<asterite> For example struct coparison is done with that: https://github.com/manastech/crystal/blob/master/src/struct.cr#L2
<asterite> That's because getters might not be available for some fields
<jhass> I see instance_variable_get/set so abused in ruby, would really like to see it private
<asterite> so it's like Ruby's instance_variable_get
<asterite> Yes, I think that too
<asterite> I'll leave clone like that for now until we have "instance_variable_set", and then we can implement it like that (with the added visibility check)
<jhass> cool
<asterite> It seems crul has more stars than DeBot now: https://crystalshards.herokuapp.com/
<asterite> You should do something about it ;)
<jhass> heh
<jhass> you should fix github_desktop_notifications, I think it has potential :P
<jhass> and I still don't even have an idea where to start looking
<asterite> I'll take a look at it, promise :)
<asterite> But I don't know when
<asterite> If you can try to reduce the code while still keeping the crash, it would be easier
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shadeslayer has quit [Ping timeout: 256 seconds]
weskinner_work has joined #crystal-lang
shadeslayer has joined #crystal-lang
havenwood has joined #crystal-lang
<crystal-gh> [crystal] Exilor opened pull request #474: Prettier SimpleHash syntax in specs (master...patch-4) http://git.io/pVk9
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/pVYs
<crystal-gh> crystal/master 3dac7db Jacob: Prettier SimpleHash syntax in specs
<crystal-gh> crystal/master 2bb195b Ary Borenszweig: Merge pull request #474 from Exilor/patch-4...
Ven has joined #crystal-lang
weskinner_work has left #crystal-lang [#crystal-lang]
<travis-ci> manastech/crystal#2117 (master - 2bb195b : Ary Borenszweig): The build passed.
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass> asterite: we'll see if it's the same bug, but I managed to produce a nil assertion in the codegen
<jhass> or something
<asterite> I'm reducing it too! :)
<asterite> One of the lines in the top is *Crystal::CodeGenVisitor#visit<Crystal::CodeGenVisitor, Crystal::RespondsTo>:Bool +2261 [4370061637] ?
<asterite> I think it's a different bug, but it will have to be fixed anyway
<asterite> I'm with 26 lines now, trying to reduce it further
<jhass> 16!
<jhass> :P
<asterite> :o
<jhass> stops when I try to take out HTTP::Response unfortunately
Ven has joined #crystal-lang
<jhass> also stops when I assign a static string to query_string
<asterite> I have this: http://paste.mrzyx.de/pmidxuguo
<asterite> I'm trying to remove the standard library classes, but I don't know how much further I can go
<jhass> line 16 can be a plain get actually
<asterite> One line: -> { ({} of String => String).map {|key| key.to_s }.to_s }
<asterite> :)
bcardiff has joined #crystal-lang
<jhass> :o
<jhass> that's weird
<jhass> one would thing we would've hit that earlier :P
<jhass> *think
<asterite> Hehe, yes
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<asterite> Well, the assertion is gone if I change the way Hash#map is implemented
<asterite> I changed some Enumerable, Array and Hash methods to use typeof, but that's not quite right
<asterite> so we'll change it back, which means the "can't infer block type" will come back (but less frequently, only if you use a free var as the output, not if you specify a type like HTTP::Response)
<asterite> but I think for now that's better than the ugliness of typeof(ugly code)
havenn has joined #crystal-lang
havenwood has quit [Ping timeout: 264 seconds]
<asterite> In any case, I'll fix the bug :)
<jhass> yeah, I'm really curious if it the assertion just doesn't trigger in the full version and generated invalid code
weskinner_work has joined #crystal-lang
<weskinner_work> I think I understand channel_primes.cr now :)
<weskinner_work> If I understand correctly the 100.times loops creates a chain of filters and a prime is any number who makes it through all the filters. Or in other words, any number that isn't evenly divisible by any of the primes before it
waj has quit [Quit: Leaving.]
asterite has quit [Quit: Leaving.]
asterite has joined #crystal-lang
bcardiff1 has joined #crystal-lang
asterite1 has joined #crystal-lang
bcardiff has quit [Ping timeout: 252 seconds]
asterite has quit [Ping timeout: 246 seconds]
orliesaurus has quit [Ping timeout: 265 seconds]
waj has joined #crystal-lang
orliesaurus has joined #crystal-lang
bcardiff has joined #crystal-lang
bcardiff1 has quit [Ping timeout: 250 seconds]
shama has joined #crystal-lang
asterite has joined #crystal-lang
<asterite> weskinner_work: exactly! But too me it's still black magic :)
bcardiff1 has joined #crystal-lang
bcardiff has quit [Ping timeout: 246 seconds]
havenn has quit [Remote host closed the connection]
<weskinner_work> :D
<asterite> >> File.join("", ""); {1, 2}.max
<DeBot> asterite: 2
leafybasil has quit [Remote host closed the connection]
ismaelga has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
<asterite> jhass: good news, I debugged your code
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/prxe
<crystal-gh> crystal/master 20240b5 Ary Borenszweig: Fixed a bug related to untyped blocks
<crystal-gh> crystal/master 9a027ad Ary Borenszweig: Fixed: don't incorrectly bind vars to themselves after blocks
<crystal-gh> crystal/master 7329543 Ary Borenszweig: Fixed a bug regarding included generic modules
<jhass> \o/
<asterite> I found like three errors, and one of them was totally screwing the type inference
<jhass> :D
<jhass> you're welcome :P
<asterite> That's why it was probably crashing, because the generated code was basically wrong wrong :)
<asterite> Now your code almost compiles, you have to specify just one block type, but where to do that is clearer now
<jhass> alright, I'll try right away, thanks so much!
<asterite> As always, these "can't infer block type" might be gone one day, maybe...
<asterite> No, thank you! We need more programs that catch these kind of bugs
<jhass> cool, even fixed one of the can't infer block types I still had, so just traded one for another :P
<jhass> I'll keep it running for a couple of hours and then push the latest version
<travis-ci> manastech/crystal#2119 (master - c001d6b : Ary Borenszweig): The build passed.
<asterite> The "can't infer block type" now only happens if it's something like &block: -> T, where T is a free variable (like in the case of Enumerable#map), but when it's, say, &block : -> HTTP::Response, it will never give that error
<jhass> cool
<jhass> asterite: https://github.com/anatol/pacoloco.cr found a crystal project before you :P
<asterite> :)
<asterite> I think he's the one who wanted to cross-compile
<asterite> for that router
<jhass> ah, right
<asterite> because it's an exact copy of this: https://github.com/sferik/twitter-crystal
ismaelga has joined #crystal-lang
<jhass> yeah, weird
weskinner_work has quit [Remote host closed the connection]
anatolik has joined #crystal-lang
havenwood has joined #crystal-lang
weskinner_work has joined #crystal-lang
bcardiff has joined #crystal-lang
<havenwood> asterite: Looking to fix my PR for #each_slice and I think I need some guidance. In Ruby `[1, 2, 3].each_with_index.to_a #=> [[1, 0], [2, 1], [3, 2]]` and `[1, 2, 3].each_slice(2).to_a #=> [[1, 2], [3]]` (they return Enumerators hence the #to_a).
<asterite> Yes... we don't have Enumerators yet
<asterite> Well, we have Iterator, which is similar, but very experimental
<havenwood> asterite: So for now better to return nil than Arrays?
<asterite> Yes
<havenwood> Roger that, will do. Thanks!
<asterite> Just yesterday we were playing with iterators and Enumerable... we managed to create one out of any Enumerable by using spawn and channels (in a way similar to Ruby, I guess)
bcardiff1 has quit [Ping timeout: 246 seconds]
<asterite> but it's slow, of course
<asterite> We toyed with the idea of creating enumerators like in C#, but that is one big task which for now I don't think we'll do
<asterite> (by the way, it's slow but faster than Ruby)
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/poy7
<crystal-gh> crystal/master 050f6b6 Ary Borenszweig: Fixed: wasn't able to write a call block argument after named arguments
<crystal-gh> crystal/master ef8bba8 Ary Borenszweig: Added macro variables (%var)
<crystal-gh> crystal/master 64a90a8 Ary Borenszweig: Macro vars can be indexed with expressions (%var{a, b})
<anatolik> Have you tried using Crystal with recently released LLVM3.6?
waj1 has joined #crystal-lang
<weskinner_work> asterite: can you explain the difference between and iterator and enumerator?
waj has quit [Ping timeout: 252 seconds]
<asterite> Not yet, it was released some weeks ago (I think) but it's not yet in popular repositories (like homebrew)
<anatolik> The reason I ask is that Linux Arch is going to have 3.6 in [testing] repository soon (maybe even today)
<asterite> weskinner_work: they are the same, just different name because Enumerator is magical in Ruby and Iterator is a module and you must include it and implement `next` (super experimental, uses exceptions for control flow, ugly!)
<asterite> weskinner_work: check iterator.cr and iterator_spec.cr
<anatolik> Here is Homebrew update for llvm https://github.com/Homebrew/homebrew/pull/37260 (not merged yet as it breaks some apps)
<asterite> anatolik: Cool
<asterite> I think it should work with llvm 3.6, except that they changed the metadata for debugging... and they changed it again in 3.7 :(
<asterite> but we don't have much debugging support right now, so it's not a big deal
<anatolik> another questions: I tried to build i686 package and I see a weird test failure: https://gist.github.com/anatol/e5d0d71159a687b318de
<anatolik> expected: 96238761247506429
<anatolik> got: 96238761247506429
<anatolik> it is the same number, the problem in the big number compare I guess
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/poND
<crystal-gh> crystal/master 685f091 Ary Borenszweig: Fixed: macro var didn't work inside string
asterite has quit [Ping timeout: 246 seconds]
bcardiff has quit [Quit: Leaving.]
<crystal-gh> [crystal] havenwood opened pull request #475: Add an optional #each_with_index offset param (master...offset) http://git.io/poj8
havenwood has quit [Remote host closed the connection]
havenwood has joined #crystal-lang
<weskinner_work> waj!: mind explaining why the tap is useful here? https://github.com/manastech/crystal/blob/master/src/concurrent/channel.cr#L106
<weskinner_work> waj1:
anatolik has left #crystal-lang [#crystal-lang]
anatolik has joined #crystal-lang
<jhass> weskinner_work: it returns the value of @value and then sets it to nil
<jhass> so value = @value.not_nil!; @value = nil; value
weskinner_work has quit [Ping timeout: 246 seconds]
weskinner_work has joined #crystal-lang
weskinner_work has quit [Ping timeout: 265 seconds]
weskinner_mac has joined #crystal-lang
waj1 has quit [Quit: Leaving.]
weskinner_mac has quit [Client Quit]
weskinner_mac has joined #crystal-lang
weskinner_mac has quit [Client Quit]