ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
Volk has joined #crystal-lang
Volk has joined #crystal-lang
Volk has quit [Changing host]
Volk has quit [Quit: See you next time!]
Volk has joined #crystal-lang
Volk has quit [Changing host]
Volk has joined #crystal-lang
Volk has quit [Quit: See you next time!]
Volk has joined #crystal-lang
Volk has quit [Changing host]
Volk has joined #crystal-lang
<f1refly> hightower: Ohhh, I missed that! Thank you!
ur5us_ has joined #crystal-lang
ur5us has quit [Ping timeout: 264 seconds]
ur5us_ has quit [Ping timeout: 268 seconds]
notzmv has quit [Ping timeout: 252 seconds]
notzmv has joined #crystal-lang
postmodern has joined #crystal-lang
<postmodern> is there a helper method in Iterator for returning a single value, then stopping on next iteration?
<postmodern> hmm wtf, why can't I use enum values in a case ... in statement?
<postmodern> enums are supposed to be exhaustive, no?
deavmi has quit [Read error: Connection reset by peer]
deavmi_ has joined #crystal-lang
<postmodern> the compiler's `if var.nil? ... elsif var.method() ...` awareness could use some work
hightower2 has quit [Ping timeout: 252 seconds]
<FromGitter> <Blacksmoke16> Do you have an example of it not working?
<postmodern> Blacksmoke16, https://carc.in/#/r/by7q
<FromGitter> <Blacksmoke16> 1) you dont need to define those `one?` method and stuff, they're added automatically ⏎ 2) it would probably work if you assigned the ivar to a variable first
postmodern has quit [Read error: Connection reset by peer]
postmodern has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://carc.in/#/r/by7t
<postmodern> Blacksmoke16, ah case style. I also noticed `if/else` worked, but `if / elsif` does not get caught by the compiler.
<postmodern> Blacksmoke16, after the initial nil check, the variable should be considered not-nil in all following branches
<FromGitter> <Blacksmoke16> not when you do `@ivar.nil?`
<postmodern> Blacksmoke16, after that branch, iff it's false
<postmodern> i'm guessing we just need better compiler logic for identifying if/elsif branches
hightower2 has joined #crystal-lang
<yxhuvud> No, if you check against an ivar, then some other fiber may change the value underneath the feet of the code.
Volk has quit [Quit: See you next time!]
hightower2 has quit [Ping timeout: 252 seconds]
Volk has joined #crystal-lang
Volk has joined #crystal-lang
Volk has quit [Changing host]
Volk has quit [Quit: See you next time!]
fifr[m] has quit [Read error: Connection reset by peer]
jhass[m] has quit [Read error: Connection reset by peer]
hamoko has quit [Write error: Connection reset by peer]
olbat[m] has quit [Read error: Connection reset by peer]
jhass[m] has joined #crystal-lang
<postmodern> yxhuvud, that's a valid concern. however `if @ivar.nil? ... else ...` works, but `if @ivar.nil? ... elsif ...` does not, which seems inconsistent.
fifr[m] has joined #crystal-lang
olbat[m] has joined #crystal-lang
hamoko has joined #crystal-lang
<FromGitter> <Blacksmoke16> got an example that shows this behavior?
<postmodern> also another method could somehow modify the ivars in the current fiber once inside a `if !@ivar.nil?` or `case @ivar` block
<FromGitter> <Blacksmoke16> right, which is the basis of the limitation
notzmv has quit [Ping timeout: 246 seconds]
notzmv has joined #crystal-lang
<postmodern> perhaps in the future it will be possible to lock an ivars value for a period of time to ensure consistency
<FromGitter> <Blacksmoke16> you already can do that `value = @ivar`
<FromGitter> <Blacksmoke16> tada
notzmv has quit [Remote host closed the connection]
hightower2 has joined #crystal-lang
ur5us_ has joined #crystal-lang
hightower2 has quit [Ping timeout: 252 seconds]
postmodern has quit [Quit: Leaving]