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
Philpax has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vwOm4
<crystal-gh> crystal/master 8666090 Nino Miletić: Minor Range improvements (#2469)...
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
<travis-ci> crystal-lang/crystal#8666090 (master - Minor Range improvements (#2469)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/124064602
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
steenuil has joined #crystal-lang
pawnbox has joined #crystal-lang
rolha_ has joined #crystal-lang
rolha has quit [Ping timeout: 268 seconds]
pawnbox has quit [Ping timeout: 276 seconds]
Philpax has quit [Read error: Connection reset by peer]
Philpax has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
willl has quit [Quit: Connection closed for inactivity]
shawn42 has joined #crystal-lang
Philpax has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] DougEverly opened pull request #2479: JSON::Any as_type? methods return Type or Nil (master...nilable_as_methods) https://git.io/vwOCZ
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 250 seconds]
mgarciaisaia has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
sp4rrow has joined #crystal-lang
broz has quit [Remote host closed the connection]
sp4rrow has quit [Client Quit]
mgarciaisaia1 has joined #crystal-lang
pawnbox has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 260 seconds]
wmoxam has quit [Remote host closed the connection]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
kulelu88 has quit [Quit: Leaving]
ozra has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
wmoxam has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
mgarciaisaia1 has left #crystal-lang [#crystal-lang]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
<nwmcsween> is it possible to declare an instance variable from all possible names within an enum?
<nwmcsween> instance variables
<nwmcsween> something like instance_variable_set from ruby
mgarciaisaia has joined #crystal-lang
trapped has joined #crystal-lang
<nwmcsween> is there a list of types within crystal?
<nwmcsween> what is a block type?
<nwmcsween> proc I guess
mgarciaisaia has left #crystal-lang [#crystal-lang]
pawnbox has quit [Remote host closed the connection]
Philpax has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
zeno has joined #crystal-lang
zeno is now known as Guest30306
Guest30306 has quit [Quit: 离开]
zeno_ has joined #crystal-lang
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
<zeno_> https://play.crystal-lang.org/#/r/wwm I tried to realize a calculator, but get a type problem now, how to solve this? Maybe I need to define a new struct?
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
brunto has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
<TheLemonMan> zeno_, try to think about the type you want and then look at the type you have
<TheLemonMan> you want exp to be either a Number or a Array(Number|String)
<TheLemonMan> and when you access via [] the exp parameter the type system infers that e{1,2} is going to be a Number|String
<TheLemonMan> and then you feed a Number|String into 'calc' again, which widens the exp to String|Number|Array(Number|String)
<TheLemonMan> lo and behold, a String is not a Number so you reach the else arm of the if, you deference the string with [] and end up with a Char
<TheLemonMan> the type widens again to include Char and the story mentioned above happens until you try to deference a Char with [] -> 'undefined method '[]' for Char'
dsounded has joined #crystal-lang
<zeno_> Yeah, I understood it. So I need to define a new struct? or any else better solutions?
<TheLemonMan> it depends on what your goal is
<TheLemonMan> if you want to build a rpn calculator then you should use the shunting-yard algorithm
Philpax has joined #crystal-lang
<TheLemonMan> otherwise, if you just want to build a function that handles [op, arg1, arg2] you could just drop the eval in the else branch
brunto has quit [Ping timeout: 246 seconds]
mark_66 has joined #crystal-lang
brunto has joined #crystal-lang
brunto has quit [Quit: leaving]
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
jeromegn has quit [Ping timeout: 244 seconds]
jeromegn has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
dsounded has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
jeromegn has quit [Ping timeout: 268 seconds]
jeromegn has joined #crystal-lang
x0f_ has quit [Ping timeout: 244 seconds]
ponga has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<zeno_> Thanks, I want to realize a Lisp interpreter
<TheLemonMan> zeno_, you might want to follow the make-a-lisp thing
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<zeno_> https://play.crystal-lang.org/#/r/wxf I tried to tell compiler I won't feed String into calc, seems not work...
x0f has joined #crystal-lang
<TheLemonMan> zeno_, type inference strikes again :)
<TheLemonMan> v1, v2 = calc(e1), calc(e2)
<TheLemonMan> as you can see, exp might faill all the if tests and return nil
<TheLemonMan> try adding a return 0 at the end and it'll magically compile :) but that's a workaround, not a solution
<zeno_> Well, let me add a return type for this function and try again
<crystal-gh> [crystal] chocolateboy opened pull request #2480: fix documentation typo: index -> rindex (master...fix-doc-typo) https://git.io/vwOHi
dsounded has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden pushed 1 new commit to master: https://git.io/vwO7u
<crystal-gh> crystal/master 4696a24 chocolateboy: fix documentation typo: index -> rindex
dsounded has quit [Ping timeout: 260 seconds]
<zeno_> I think return 0 is a solution, compiler find that there's some control branches are still undeclared so function maybe return a Nil, just clearly announced that it will return 0 when missing all the if and case, even if I won't do that forever
<TheLemonMan> you should instead try to make the function always return a Number
dsounded has joined #crystal-lang
<travis-ci> crystal-lang/crystal#4696a24 (master - fix documentation typo: index -> rindex): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/124132090
<jhass> nwmcsween: I don't get the first question. Not quite but you can solve most of those usecases with macro's or the (undocumented I think) object.@var syntax, but usually there's a better way than either. Are you looking for the API docs? See /topic. Not all blocks are turned into Procs, they're rather a compile time language construct. But there's conversion/capturing support to do turn blocks into Procs
<jhass> and invoke Procs like blocks in methods expecting blocks.
<TheLemonMan> hmm, it seems you can't pass a function in place of a block
mlitwiniuk has joined #crystal-lang
<jhass> TheLemonMan: https://carc.in/#/r/wy1 :)
Philpax_ has quit [Ping timeout: 276 seconds]
dsounded has quit [Read error: Connection reset by peer]
dsounded has joined #crystal-lang
<zeno_> jhass: Yeah, seems I still not adapt type inference
<TheLemonMan> hmm, I've implemented folding for the Enumerable struct, would you be interested in such a PR ?
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
<jhass> #reduce?
<jhass> (Enumerable is a module btw)
<jhass> http://crystal-lang.org/api/Enumerable.html#reduce%28%26block%29-instance-method
soveran has quit [Remote host closed the connection]
dsounded has quit [Read error: Connection reset by peer]
dsounded has joined #crystal-lang
Philpax has joined #crystal-lang
dsounded has quit [Read error: Connection reset by peer]
dsounded has joined #crystal-lang
trapped has joined #crystal-lang
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 276 seconds]
Philpax_ has quit [Read error: Connection reset by peer]
trapped has quit [Read error: Connection reset by peer]
trapped has joined #crystal-lang
Philpax_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
soveran has joined #crystal-lang
pawnbox has joined #crystal-lang
dsounded has quit [Read error: Connection reset by peer]
Davy_CC has quit [Ping timeout: 260 seconds]
Davy_CC has joined #crystal-lang
dsounded has joined #crystal-lang
soveran has quit [Remote host closed the connection]
ozra has joined #crystal-lang
zeno_ has quit [Ping timeout: 276 seconds]
<crystal-gh> [crystal] DougEverly closed pull request #2479: JSON::Any as_type? methods return Type or Nil (master...nilable_as_methods) https://git.io/vwOCZ
<crystal-gh> [crystal] DougEverly reopened pull request #2479: JSON::Any as_type? methods return Type or Nil (master...nilable_as_methods) https://git.io/vwOCZ
ql6wlld has joined #crystal-lang
TheLemonMan has quit [Read error: Connection reset by peer]
TheLemonMan has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
dsounded has quit [Read error: Connection reset by peer]
soveran has quit [Ping timeout: 260 seconds]
dsounded has joined #crystal-lang
zeno_ has joined #crystal-lang
ql6wlld has quit [Quit: WeeChat 1.4]
dsounded has quit [Remote host closed the connection]
ozra has quit [Quit: Konversation terminated!]
dsounded has joined #crystal-lang
Raimondi has quit [Ping timeout: 252 seconds]
Raimondi has joined #crystal-lang
broz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
dsounded has quit [Read error: Connection reset by peer]
dsounded has joined #crystal-lang
Nik- has joined #crystal-lang
dsounded has quit [Remote host closed the connection]
rolha_ has quit [Quit: Textual IRC Client: www.textualapp.com]
Philpax_ has quit [Ping timeout: 250 seconds]
<asterite> zeno_: https://play.crystal-lang.org/#/r/x1y (you must handle the case where an operand is a String, and when you eval a function you must guarantee the compiler that you are dealing with an array)
<zeno_> Yeah, I almost understood it, thank you :)
<zeno_> And try to adapt it...
rocx has joined #crystal-lang
ql6wlld has joined #crystal-lang
soveran has joined #crystal-lang
kfpratt 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]
soveran has quit [Ping timeout: 276 seconds]
<rocx> hey. question about compiling crystal. would there be a simpler way to compile via `g++` or does it need to use `clang`?
<jhass> gcc/g++ should work just fine
<jhass> do we hardcode clang anywhere?
<jhass> I can't remember so
<TheLemonMan> libclang maybe
<rocx> iunno. i'm just having a hard time trying to compile it with `make`.
<rocx> whenever i try to run a simple `make`, it comes up with: g++: error: /void-packages/common/environment/configure/gccspecs/hardened-cc1: No
<rocx> such file or directory
<jhass> huh
<rocx> not having luck trying to figure that out since the most i'm finding is "you need to install gcc-g++".
<jhass> well that seems more like an OS issue
<rocx> it probably is and i don't even know where to begin.
<rocx> besides pestering whoever packages this stuff. wouldn't be a first time i had a flagrant issue with their idea of letting the community package thing with very loose guidelines.
<jhass> maybe we should move to #voidlinux?
<TheLemonMan> packaging is tricky since you have to boostrap the compiler
<jhass> well, that's why we provide pretty self-contained tarballs
<rocx> jhass: nah. i'll just move to probably something like funtoo or something more people use. void linux's pissed me off many times before.
<jhass> and ensure the previous version of a compiler can compile the current one
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
dsounded has joined #crystal-lang
dsounded has quit [Ping timeout: 260 seconds]
miketheman has quit [Quit: ZNC - http://znc.in]
miketheman has joined #crystal-lang
rocx has left #crystal-lang ["ERC (IRC client for Emacs 24.5.1)"]
Nik- has quit [Quit: Textual IRC Client: www.textualapp.com]
pawnbox has quit [Ping timeout: 252 seconds]
mark_66 has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
pawnbox has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
ql6wlld has quit [Quit: WeeChat 1.4]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
dome22xl has joined #crystal-lang
<dome22xl> Hi Guys, I've posted an article on LinkedIn regarding Crystal - https://www.linkedin.com/pulse/ruby-vs-crystal-part-1-brian-hood
<dome22xl> Have a read i will get more in depth with the next post
dome22xl has quit [Ping timeout: 244 seconds]
trapped has quit [Read error: Connection reset by peer]
Ven has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
ssvb_ has quit [Ping timeout: 268 seconds]
ssvb_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] asterite opened pull request #2481: Time: honor Daylight Saving and ENV["TZ"] (master...feature/time_dst) https://git.io/vwsFH
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
rok has joined #crystal-lang
pawnbox has joined #crystal-lang
rok has quit [Quit: rok]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vwsjK
<crystal-gh> crystal/master 0dbcda7 Ary Borenszweig: ENV: allow passing `nil` as a value to delete and environment variable
BlaXpirit has quit [Quit: Bye]
BlaXpirit has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vwGvp
<crystal-gh> crystal/master 1c02f9e Ary Borenszweig: Use `$HOME/cache/.crystal` (or others similar) as the default cache dir, and only keep the 10 most recently used directories. Fixes #2435 (#2476)
<travis-ci> crystal-lang/crystal#0dbcda7 (master - ENV: allow passing `nil` as a value to delete and environment variable): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/124294415
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vwGUd
<crystal-gh> crystal/master 3e440df Ary Borenszweig: Fixed #2468: compiler crash if redefining c-external function with different signature
<travis-ci> crystal-lang/crystal#1c02f9e (master - Use `$HOME/cache/.crystal` (or others similar) as the default cache dir, and only keep the 10 most recently used directories. Fixes #2435 (#2476)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/124298358
<travis-ci> crystal-lang/crystal#a79d8cd (master - When doing `crystal file.cr x y z`, assume `x y z` are program arguments. (#2478)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/124298400
ponga has quit [Quit: Connection closed for inactivity]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
<travis-ci> crystal-lang/crystal#3e440df (master - Fixed #2468: compiler crash if redefining c-external function with different signature): The build was broken. https://travis-ci.org/crystal-lang/crystal/builds/124302872
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vwGqO
<crystal-gh> crystal/master 12569c0 Ary Borenszweig: Samples: fixed wrong signature in fun redefinition
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
BlaXpirit has quit [Quit: Bye]
rolha has joined #crystal-lang
<rolha> hello everyone
<jhass> hi
<rolha> is the any shard for writing PNGs?
<rolha> jhass: hi :)
<rolha> I tried crystalshards.xyz but couldn't find anything (just double-checking)
<rolha> just checking if anyone knew of anything, thanks! :)
<jhass> writing a libpng binding is probably a fun exercise though ;)
<travis-ci> crystal-lang/crystal#12569c0 (master - Samples: fixed wrong signature in fun redefinition): The build was fixed. https://travis-ci.org/crystal-lang/crystal/builds/124310787
trapped has joined #crystal-lang
BlaXpirit has joined #crystal-lang
soveran has quit [Remote host closed the connection]
wmoxam has quit [Ping timeout: 244 seconds]
wmoxam has joined #crystal-lang
Philpax_ has joined #crystal-lang
greengriminal has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
rolha has quit [Remote host closed the connection]
rolha has joined #crystal-lang
Philpax_ has quit [Ping timeout: 250 seconds]
zeno_ has quit [Ping timeout: 250 seconds]
zeno_ has joined #crystal-lang
petercommand has quit [Ping timeout: 276 seconds]
greengriminal has quit [Quit: Leaving]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
petercommand has joined #crystal-lang
rolha has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rolha has joined #crystal-lang
zeno_ has quit [Ping timeout: 268 seconds]
zeno_ has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 276 seconds]