umurgdk has quit [Remote host closed the connection]
umurgdk has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
umurgdk has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
umurgdk has joined #crystal-lang
shibly has joined #crystal-lang
shibly has left #crystal-lang [#crystal-lang]
zipR4ND has quit [Ping timeout: 268 seconds]
umurgdk has quit [Remote host closed the connection]
umurgdk has joined #crystal-lang
rolha has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
Philpax has quit [Ping timeout: 252 seconds]
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/vwuE2
<crystal-gh>
crystal/master da078e2 Ary Borenszweig: Compiler: check if C function needs to be converted to a Crystal proc when accesing it through an instance var. Fixes #2515
BlaXpirit has quit [Quit: Bye]
BlaXpirit has joined #crystal-lang
BlaXpirit has quit [Client Quit]
BlaXpirit has joined #crystal-lang
ssvb has quit [Ping timeout: 252 seconds]
mark_66 has quit [Remote host closed the connection]
ssvb has joined #crystal-lang
willl has joined #crystal-lang
<rolha>
hi everyone!
<rolha>
where can I find an example on implementing Enumerable?
<rolha>
nevermind, sorry... found it in crystal's source
umurgdk has joined #crystal-lang
<rolha>
also (sorry about my constant noobish crystal questions)
<rolha>
the way namespaces work, is it a bad idea to shadow a base class? Say, creating a Module::Array?
umurgdk has quit [Ping timeout: 260 seconds]
umurgdk has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<BlaXpirit>
rolha, it's fine in a namespace
soveran has joined #crystal-lang
<rolha>
BlaXpirit, cool! thanks
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
globalkeith has quit [Read error: Connection reset by peer]
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 276 seconds]
soveran has joined #crystal-lang
client_ has joined #crystal-lang
umurgdk has joined #crystal-lang
client_ has quit [Client Quit]
kulelu88 has joined #crystal-lang
kulelu88 has quit [Quit: Leaving]
Ven has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
shawn42 has left #crystal-lang [#crystal-lang]
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/vwzqZ
<crystal-gh>
crystal/master 0228621 Ary Borenszweig: Compiler: a fix in the new/initialize logic
<rolha_>
but if I pass Optional in nested mappings I still need to have a "try" for every time I do an operation
<rolha_>
but I'm not saying this is a limitation in any way
<rolha_>
I'm just trying it to learn a bit of Crystal too
<rolha_>
I'm just wondering why the "transform" method is incompatible with the type grammar
<rolha_>
Optional.apply(yield @value) will never by Nil
<rolha_>
since I check it before hand
<BlaXpirit>
rolha_, such a conditional does not hint the compiler in any way
<BlaXpirit>
because it is a simple usermode method
<rolha_>
so, since I'm obiviously not understanding Crystal types ;), what would be the best way to implement
<BlaXpirit>
rolha_, the best way is to switch these branches: if @value; self; else; ;...
<BlaXpirit>
also note that in the next version of Crystal .nil? will indeed filter types like you're expecting here
<rolha_>
Optional.apply(2.0).transform {|x| x +1 } # Optional(3.0) and
<rolha_>
Optional.apply(nil).transform {|x| x +1 } # Optional(nil)
<rolha_>
BlaXpirit: thanks, I'll look it into!
<rolha_>
*into it
<BlaXpirit>
I don't understand the purpose of 'apply' if it just calls 'new'
<rolha_>
well, I now, it just a Scala idiom :-P
<rolha_>
Option.apply(T) is the way to create an optional
<rolha_>
just following scala's naming as a training wheel ...
<crystal-gh>
[crystal] asterite closed pull request #2486: Guess types from `T.method`, if `T.method` has a return type annotation (master...feature/more_inference) https://git.io/vwn1K
<BlaXpirit>
rolha_, I see that you're trying to learn but I don't think learning by avoiding the language's idioms makes sense
<BlaXpirit>
I wonder how to walk an AST tree and, for example, modify all variable names
<rolha_>
"If an if's condition is var.nil? then the type of var in the then branch is known by the compiler to be Nil, and to be known as non-Nil in the else branch"
<rolha_>
but Crystal still seems to think that @value in the else branch might be Nil
<BlaXpirit>
rolha_, oh sorry, and what I said what also incorrect
<rolha_>
in ./spec/optional.cr:19: undefined method '+' for Nil (compile-time type is Float64?)