jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.15.0 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
matp_ has joined #crystal-lang
matp has quit [Ping timeout: 246 seconds]
matp_ is now known as matp
pawnbox has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 252 seconds]
Philpax has joined #crystal-lang
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
triangles has quit [Quit: Leaving]
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 244 seconds]
A124 has quit [Read error: Connection reset by peer]
A124 has joined #crystal-lang
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox_ has quit [Ping timeout: 244 seconds]
Raimondi has quit [Ping timeout: 260 seconds]
ome has joined #crystal-lang
pawnbox has joined #crystal-lang
tzesh has joined #crystal-lang
tzesh has quit [Client Quit]
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 240 seconds]
tkyshm has joined #crystal-lang
broz has joined #crystal-lang
Philpax has quit [Ping timeout: 252 seconds]
broz has quit []
Guest88399 has quit [Ping timeout: 260 seconds]
nwmcsween has joined #crystal-lang
nwmcsween is now known as Guest36091
pawnbox has quit [Remote host closed the connection]
BlaXpirit has quit [Ping timeout: 260 seconds]
BlaXpirit has joined #crystal-lang
umurgdk has joined #crystal-lang
pawnbox has joined #crystal-lang
umurgdk has quit [Ping timeout: 276 seconds]
Philpax has joined #crystal-lang
mark_66 has joined #crystal-lang
tkyshm has left #crystal-lang ["WeeChat 1.4"]
ome has quit [Quit: Connection closed for inactivity]
BlaXpirit has quit [Quit: Bye]
BlaXpirit has joined #crystal-lang
<olbat> (and then open a Request For Package on Debian's bug tracker, for the project to be packaged in the next Debian release)
<olbat> oops sry :)
soveran has joined #crystal-lang
soveran has joined #crystal-lang
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 260 seconds]
Philpax has quit [Ping timeout: 252 seconds]
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 250 seconds]
TheLemonMan has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<crystal-gh> [crystal] jhass closed pull request #2511: Fix filtering of `allocate` for doc-gen (master...fix/filter-out-allocate-for-docs) https://git.io/vw0xV
<crystal-gh> [crystal] jhass pushed 2 new commits to master: https://git.io/vwEux
<crystal-gh> crystal/master a7322b9 Malo Jaffré: Cleanup docs/main.cr....
<crystal-gh> crystal/master 00b3bf1 Jonne Haß: Merge pull request #2510 from MaloJaffre/patch-1...
petercommand has quit [Ping timeout: 246 seconds]
umurgdk has joined #crystal-lang
globalkeith has joined #crystal-lang
<travis-ci> crystal-lang/crystal#0b9d9de (master - Merge pull request #2511 from ozra/fix/filter-out-allocate-for-docs): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/125506598
petercommand has joined #crystal-lang
Philpax has joined #crystal-lang
<travis-ci> crystal-lang/crystal#00b3bf1 (master - Merge pull request #2510 from MaloJaffre/patch-1): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/125506681
pawnbox has joined #crystal-lang
petercommand has quit [Ping timeout: 260 seconds]
petercommand has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
trapped has joined #crystal-lang
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]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
umurgdk has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
sdogruyol has quit [Quit: Connection closed for inactivity]
umurgdk has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Raimondi has joined #crystal-lang
umurgdk has joined #crystal-lang
Raimondi has quit [Ping timeout: 252 seconds]
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
ponga has joined #crystal-lang
soveran has joined #crystal-lang
Raimondi has joined #crystal-lang
asie has quit [Quit: WeeChat 1.4]
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]
zipR4ND has joined #crystal-lang
umurgdk has joined #crystal-lang
asie has joined #crystal-lang
Netfeed has quit [Ping timeout: 250 seconds]
olbat has quit [Ping timeout: 250 seconds]
olbat has joined #crystal-lang
Netfeed has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vwuTX
<crystal-gh> crystal/master c1affec Ary Borenszweig: Fixed #2512: allow HTTP::Client::Response without mandatory body but Content-Length == 0
pawnbox has quit [Remote host closed the connection]
Netfeed has joined #crystal-lang
Netfeed has quit [Changing host]
umurgdk has joined #crystal-lang
<travis-ci> crystal-lang/crystal#c1affec (master - Fixed #2512: allow HTTP::Client::Response without mandatory body but Content-Length == 0): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/125562116
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
pawnbox 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
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
_whitelogger has joined #crystal-lang
<travis-ci> crystal-lang/crystal#0228621 (master - Compiler: a fix in the new/initialize logic): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/125646712
crime has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
willl has quit [Remote host closed the connection]
<rolha_> I'm having trouble understanding something in the type system
rolha_ has joined #crystal-lang
<rolha_> I'm trying to implement an "optional" type as such: http://pastebin.com/hCtEyzzE
<BlaXpirit> rolha_, why? just use `Type?`
<rolha_> my specs would be something like a = Optional(2.0) ; a.value = 2.0
<rolha_> I wanted (for fun) try to implement a monad in crystal
<BlaXpirit> crystal has very good support for optionals, and what you're doing is very suboptimal
<rolha_> but what if I do a = [1.0, 2.0, nil, 3.0], a.map {|x| x + 1}
<BlaXpirit> well what if you do that with your Optional type? nothing better
<rolha_> I would like something like b = [2.0, 3.0, nil, 4.0]
<BlaXpirit> rolha_, well this is a thing
<BlaXpirit> a = [1.0, 2.0, nil, 3.0]; a.map {|x| x.try { |x| x + 1 } }
<BlaXpirit> >> a = [1.0, 2.0, nil, 3.0]; a.map {|x| x.try { |x| x + 1 } }
<DeBot> BlaXpirit: # => [2, 3, nil, 4] - https://carc.in/#/r/xh2
<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_> this is what confused me slightly: http://crystal-lang.org/docs/syntax_and_semantics/if_var_nil.html
<rolha_> BlaXpirit: very true :)
<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?)
<rolha_> optional.transform { |v| v + 1.0 }
<BlaXpirit> lower half rather
<rolha_> ahhhh ... makes perfect sense now, thanks :)
<rolha_> or at least I know why the if else with nil was not working as the previous link
<rolha_> thanks
<travis-ci> crystal-lang/crystal#276389e (master - Guess types from `T.method`, if `T.method` has a return type annotation (#2486)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/125666241
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
rolha_ has quit [Remote host closed the connection]
rolha_ has joined #crystal-lang
<BlaXpirit> you can wrap some code into other code with macros, but modifying the code is nearly impossible
<rolha_> BlaXpirit: I think this works def transform(&bloc) : Optional ; @value = @value.try {|v| puts(v) ; yield v} ;self ; end
<rolha_> yeah, it does
<rolha_> Optional.apply(2.0).transform {|x| x +1 } # Optional(3.0) and
<rolha_> Optional.apply(nil).transform {|x| x +1 } # Optional(nil)
<BlaXpirit> rolha_, OK but what about a list?
<BlaXpirit> I think it's as verbose (if not more) as with normal '?' type
<rolha_> yikes ... one step at the time ;)
<BlaXpirit> by list I mean Array
<BlaXpirit> I hope you're not going to implement 100 methods for all possible use cases
<rolha_> I'm a crystal level 0,,,I'm still trying to understand how to pass blocks
<rolha_> ;)
<rolha_> but it's a good point to look into
<BlaXpirit> rolha_, a = [1.0, 2.0, nil, 3.0]; a.map &.try { |x| x + 1 }
<BlaXpirit> basically add '&.try' in there and you get optionals support in any operation
<rolha_> I'm not saying it's "better" ;) It's a toy experience
crime has quit [Ping timeout: 250 seconds]
<jokke> can i somehow make benchmarks run subsequentially?
<jokke> i'm trying to measure throughput to a database with different schemas
<jokke> so if they run concurrently it kinda messes up the whole benchmark
<BlaXpirit> jokke, no way that they're running concurrently. what do you mean?
<BlaXpirit> do you mean your code runs concurrently? or the benchmark tool itself
<jokke> i thought the benchmark tool did, but i looked at the code, and it doesn't seem to
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
soveran has quit [Remote host closed the connection]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
A124 has quit [Ping timeout: 240 seconds]
trapped has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
Cidan has quit [Ping timeout: 246 seconds]
Cidan has joined #crystal-lang
Mihangel has joined #crystal-lang
<Mihangel> sasd
<Mihangel> anyone ?
soveran has joined #crystal-lang
willl has joined #crystal-lang
Philpax has joined #crystal-lang
soveran has quit [Ping timeout: 276 seconds]
crime has joined #crystal-lang
Philpax has quit [Ping timeout: 252 seconds]
jfontan has quit [Ping timeout: 264 seconds]
rolha_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rolha has quit [Quit: Textual IRC Client: www.textualapp.com]
jfontan has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Mihangel has quit [Quit: Page closed]
pawnbox has quit [Ping timeout: 250 seconds]
ome has joined #crystal-lang
ome has quit [Changing host]
ome has joined #crystal-lang
ome has joined #crystal-lang