jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.13.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
luislavena has quit [Quit: Leaving]
grindhold has quit [Read error: Connection reset by peer]
Ven has quit [Ping timeout: 246 seconds]
grindhold has joined #crystal-lang
Gasher^ has quit [Quit: Leaving]
Ven has joined #crystal-lang
Philpax has quit [Ping timeout: 260 seconds]
Philpax has joined #crystal-lang
cyjimmy264 has quit [Ping timeout: 276 seconds]
hitigon has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
krtv` has quit [Ping timeout: 248 seconds]
krtv` has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
hitigon has quit [Ping timeout: 260 seconds]
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 276 seconds]
Philpax has quit [Ping timeout: 260 seconds]
bcardiff has joined #crystal-lang
bcardiff has quit [Quit: bcardiff]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
Philpax has joined #crystal-lang
bcardiff has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
A124 has quit [Quit: '']
A124 has joined #crystal-lang
bcardiff has quit [Quit: bcardiff]
umurgdk has joined #crystal-lang
pawnbox has joined #crystal-lang
marcosdsanchez has quit [Read error: Connection reset by peer]
umurgdk has quit [Ping timeout: 248 seconds]
marcosdsanchez has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
Philpax has quit [Ping timeout: 260 seconds]
Philpax has joined #crystal-lang
Philpax has quit [Read error: Connection reset by peer]
umurgdk has joined #crystal-lang
umurgdk has quit [Ping timeout: 250 seconds]
Philpax has joined #crystal-lang
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 244 seconds]
trapped has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has joined #crystal-lang
trapped_ has joined #crystal-lang
trapped has quit [Ping timeout: 244 seconds]
Philpax has quit [Read error: Connection reset by peer]
rok has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
umurgdk has joined #crystal-lang
<BlaXpirit> what the hell does this mean https://travis-ci.org/BlaXpirit/crystal-lib#L302
umurgdk has quit [Ping timeout: 264 seconds]
umurgdk has joined #crystal-lang
trapped_ has quit [Read error: Connection reset by peer]
unshadow has joined #crystal-lang
Ven has quit [Ping timeout: 268 seconds]
Ven has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 268 seconds]
cyjimmy264 has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
rok has quit [Ping timeout: 276 seconds]
rok has joined #crystal-lang
Cidan has quit [Ping timeout: 276 seconds]
jhass has quit [Ping timeout: 264 seconds]
jhass has joined #crystal-lang
cyjimmy264 has quit [Remote host closed the connection]
Cidan has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
rok has quit [Quit: rok]
pawnbox has joined #crystal-lang
<BlaXpirit> how can I report bugs about Crystal Travis CI support?
jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.14.1 | 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
ql6wlld has joined #crystal-lang
bjz has joined #crystal-lang
umurgdk has joined #crystal-lang
umurgdk has quit [Read error: Connection reset by peer]
umurgdk has joined #crystal-lang
umurgdk has quit [Remote host closed the connection]
bjz_ has quit [Ping timeout: 252 seconds]
<BlaXpirit> I don't know what's happening. I've tried testing so many things lately and everything fails (on Ubuntu 14.04)
<BlaXpirit> crystal_lib gives a weird error in compiler source
<BlaXpirit> crystal-icr builds for a very long time then runs out of memory
pawnbox has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
bcardiff has joined #crystal-lang
<jeromegn> BlaXpirit: the custom travis config is because you need llvm-dev?
<BlaXpirit> jeromegn, uh yes
<BlaXpirit> jeromegn, actually custom config because crystal travis config is broken on ubuntu 14.04
<BlaXpirit> or maybe it's sudo: required that does it
<jeromegn> probably not the issue but.. whenever I had problems like that in Ruby, it was due to the load order of files when loading with a glob. the files were ordered differently between ubuntu and os x, I had to sort the files before requiring them.
<BlaXpirit> what llvm is used to build crystal ubuntu packages???
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 joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
trapped has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
pawnbox__ has joined #crystal-lang
pawnbox_ has quit [Ping timeout: 264 seconds]
pawnbox has quit [Ping timeout: 250 seconds]
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
bjz has quit [Quit: Textual IRC Client: www.textualapp.com]
bjz has joined #crystal-lang
Gasher has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
mgarciaisaia has left #crystal-lang [#crystal-lang]
Ven has quit [Ping timeout: 244 seconds]
Ven has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vaHDo
<crystal-gh> crystal/master d8d211d Ary Borenszweig: Compiler: moved OptionParser::Exception handler up. Fixes #2345
<crystal-gh> crystal/master be4b0ba Ary Borenszweig: Formatter: handle `foo &.bar.is_a?(Baz)`. Fixes #2344
splattael has joined #crystal-lang
<splattael> hi :-)
<splattael> Is there a way to determine if a var is `uninitialized`?
<splattael> `uninitialized` vars are "truthy" so a simple if var doesn't work
<BlaXpirit> splattael, uninitialized vars can have any random value, they are not safe to use and you can't check whether they're initialized
<BlaXpirit> if you have some doubts about best practices, ask away, but this sounds like a bad idea in the first place
<Papierkorb> Surprised that crystal even has uninitialized variables
<splattael> BlaXpirit: thanks. You're right, it is a bad idea. I'm porting some clunky Java code to Crystal and try to stay as close as possible to the original (clunky) code.
<splattael> All I want (or even have to) is to avoid nilable values.
<splattael> ...which existed in original Java code _everywhere_
<jeromegn> what am I missing? https://play.crystal-lang.org/#/r/uqe this makes no sense. JSON::Any#as_a.first should be a JSON::Any
<jeromegn> blah, apparently I can just use [String | Int]
<BlaXpirit> jeromegn, I think how it works is... initially everything is an 'Any'
<jeromegn> yea
<BlaXpirit> but as soon as you use 'as_...' the whole structure you get is all unions and not 'Any'
<jeromegn> oh
<jeromegn> that would explain it
<BlaXpirit> >> JSON.parse("[[[6]]]").as_a.class
<DeBot> BlaXpirit: undefined constant JSON - https://carc.in/#/r/uqf
<crystal-gh> [crystal] asterite opened pull request #2346: Compiler: add `--check` flag to formatter tool. Fixes #2328 (master...feature/format_check) https://git.io/vaHja
<BlaXpirit> Array(JSON::Type) it is
<BlaXpirit> jeromegn, so your code can be replaced with json[0].as_h
<jeromegn> indeed
<jeromegn> thanks BlaXpirit :)
<asterite> splattael: nil should be used for that (means "absence of value")
<asterite> `uninitialized` is mostly for low-level code that needs to be performant, or for stack-allocated byte buffers
<asterite> splattael: I guess in your case you don't need to do nil checks with `if var`... in Java every variable that has a class type can also be null, so you have to be very defensive all the time if somebody slips a null. In Crystal there's no need for that
Gasher has quit [Quit: Leaving]
Gasher has joined #crystal-lang
bcardiff has quit [Quit: bcardiff]
pawnbox has joined #crystal-lang
pawnbox__ has quit [Ping timeout: 250 seconds]
<splattael> asterite: yes, this is the point. The Java code base has nilable types everywhere ;) Adding null object patterns should solve this for Crystal :-)
<splattael> for example: empty profile will be a null object instead of just `null`.
<splattael> Crystal has already caught possible bugs during porting. This is nice!
<asterite> splattael: I think I would still use `nil` in that case, it's simpler to deal with rather than having to create a full blown null pattern object, and the compiler will tell you when you try to use a nilable value incorrectly (just my opinion, though)
mgarciaisaia has joined #crystal-lang
mgarciaisaia has quit [Client Quit]
bcardiff has joined #crystal-lang
Gasher has quit [Quit: Leaving]
<splattael> asterite: here is my use case which won't compile: https://gist.github.com/splattael/e071f987c908584d2c62
* splattael In this case I'm returning (or have to?) a "null" `Rank`
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
mgarciaisaia has joined #crystal-lang
<asterite> splattael: looks good. You can use this: http://crystal-lang.org/docs/syntax_and_semantics/if_var.html
mgarciaisaia has left #crystal-lang [#crystal-lang]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vaQuB
<crystal-gh> crystal/master acc27dc Ary Borenszweig: Compiler: fixed regression of captured block returning a more specific type than the specified return type. Fixes #2347
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vaQzS
<crystal-gh> crystal/master 4ff8581 Ary Borenszweig: Fixed a couple of typos [ci skip]
bcardiff_ has joined #crystal-lang
bcardiff has quit [Ping timeout: 264 seconds]
bcardiff_ is now known as bcardiff
<splattael> asterite: I see, but would handle this situation during tests with `minitest`. `if var` in tests seems strange. Does it also work with `assert var; assert_equal "foo", var.uid`?
<travis-ci> crystal-lang/crystal#acc27dc (master - Compiler: fixed regression of captured block returning a more specific type than the specified return type. Fixes #2347): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/117756999
rok_ has joined #crystal-lang
<asterite> No, it'll give you the same error. In a test you can probably use var.not_nil!.uid. The `not_nil!` is basically a runtime assertion
<splattael> Aah, perfect!
<splattael> asterite: thank you :-)
ARM9 has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vaQDG
<crystal-gh> crystal/master aad4389 Ary Borenszweig: Merge branch 'release/0.14'
bcardiff_ has joined #crystal-lang
bcardiff has quit [Ping timeout: 248 seconds]
bcardiff_ is now known as bcardiff
jamie_ca has quit [Ping timeout: 240 seconds]
unshadow has quit [Ping timeout: 244 seconds]
ql6wlld has quit [Quit: WeeChat 1.4]
jamie_ca has joined #crystal-lang
unshadow has joined #crystal-lang
<travis-ci> crystal-lang/crystal#aad4389 (master - Merge branch 'release/0.14'): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/117771926
* donpdonp throws confetti into the air for the passing build.
marcosdsanchez has quit [Read error: Connection reset by peer]
marcosdsanchez has joined #crystal-lang
[rust] has joined #crystal-lang
fowlduck has joined #crystal-lang
<fowlduck> how can I keep up with crystal lang development? I heard there was some sort of major shift in the project and I'm trying to research it
<splattael> I've got a question about Array#sort: Shouldn't be `[1,2] == [1,2].sort { 0 }` be `true`?
Gasher has joined #crystal-lang
<splattael> It is `true` in Ruby and Java
<RX14> >>[1,2] == [1,2].sort { 0 }
<DeBot> RX14: # => false - https://carc.in/#/r/uro
<RX14> >>[1,2] == [1,2]
<DeBot> RX14: # => true - https://carc.in/#/r/urp
<RX14> >>[1,2].sort { 0 }
<DeBot> RX14: # => [2, 1] - https://carc.in/#/r/urq
<RX14> >>[1,2].sort { 0 }
<DeBot> RX14: # => [2, 1] - https://carc.in/#/r/urr
pawnbox_ has quit [Remote host closed the connection]
<RX14> well the default sort doesn't keep elements in thew same order
<splattael> RX14: is this behaviour expected?
fowlduck has left #crystal-lang [#crystal-lang]
<RX14> depends what you mean expected?
<RX14> there have been some grumblings about it
<splattael> oh ok, mhh
<RX14> there should probably be more discussion about it really
<RX14> make a github issue
pawnbox has joined #crystal-lang
<splattael> will do, thanks!
[rust] has left #crystal-lang [#crystal-lang]
<crystal-gh> [crystal] MaloJaffre opened pull request #2349: Remove browser tool completion. (master...remove-browser) https://git.io/va7kv
<RX14> BlaXpirit, ^
<BlaXpirit> thx for ping
<RX14> you should comment on it about having a stable sort
<BlaXpirit> exactly what i'm doing
slash_nick is now known as slash_kick
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
salvor has quit [Ping timeout: 260 seconds]
salvor has joined #crystal-lang
ARM9 has quit [Ping timeout: 260 seconds]
grindhold has quit [Ping timeout: 260 seconds]
grindhold_ has joined #crystal-lang
Netfeed has quit [Ping timeout: 260 seconds]
ARM9 has joined #crystal-lang
Netfeed has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
Dreamer3 has quit [Ping timeout: 250 seconds]
Dreamer3_ has quit [Ping timeout: 268 seconds]
crime has joined #crystal-lang
<crime> you guys, i LOVE 'crystal play'
<crime> what a great idea
Excureo has quit [Remote host closed the connection]
bcardiff has quit [Quit: bcardiff]
<BlaXpirit> indeed
slash_kick is now known as slash_nick
<BlaXpirit> and much better than any REPL
Netfeed has joined #crystal-lang
Netfeed has quit [Changing host]
<vegai> it's nice, but that's taking it a bit far :)
<vegai> this recompiles the whole source every time something changes, right?
<vegai> whereas a good repl allows me to dive into an application and do things to it one at a time
<mambocab> if I understand correctly, having to recompile all the source each time is limitation of the compiler right now
<vegai> oh, quite interesting if that could change
<RX14> why does this compile in 0.13 https://carc.in/#/r/uuf
<RX14> vegai, i don't think so
<RX14> it's a limit of being compiled really
<crime> yeah, REPLs are pretty nice. SLIME for example is a good one for lisp
<ARM9> wrong, it's because they disregarded incremental compilation from the get go like rust. on the site there's a post mentioning a compiler rewrite that'll take it into account
<RX14> how will incremental compilation help a REPL?
<ARM9> not having to rebuild anything
<ARM9> unless you modify some old piece of code
<RX14> that's not really how it works i don't think
<ARM9> feel free to elaborate
pawnbox has quit [Ping timeout: 244 seconds]
<RX14> incremental compilation means compiling only the minimal amount of changes, it's aimed to make compiler times unneccesary
<RX14> a REPL is more like incremental execution
<RX14> which isn't possible in crystal
marcosdsanchez has quit [Read error: Connection reset by peer]
marcosdsanchez has joined #crystal-lang
<donpdonp> what method is called on value in "#{value}" ?
<RX14> to_s I think
<donpdonp> i thought is was #to_s but its not working :(
<RX14> huh
<RX14> to_s(io)
<RX14> of course
<donpdonp> hmm.
<RX14> yeah because you should never overide to_s(void)
<RX14> always use to_s(io)
<donpdonp> how is io used in the method?
<RX14> the default to_s passes in a stringbuilder as the IO
<RX14> it's mainly for performance reasons
<donpdonp> its still unclear how to override to_s
<RX14> like "#{object}" can be compiled to object.to_s STDOUT
<RX14> donpdonp, def to_s(io)
<donpdonp> a StringBuilder has def write(slice : Slice(UInt8))
<RX14> donpdonp, https://carc.in/#/r/uum
<RX14> donpdonp, it includes the IO mixin
<RX14> you want to look at the IO doc
<donpdonp> that example is good enough. thx
bcardiff has joined #crystal-lang
crime has quit [Ping timeout: 250 seconds]
Excureo has joined #crystal-lang
tilpner has joined #crystal-lang
<tilpner> Why does a "Hello World" binary link against libpcre?
<RX14> because it includes the standard library, I think there's a cxompiler flag to stop that
<tilpner> Oh, so it doesn't matter which part I "require", it will include everything anyways? Is the standard library pre-compiled and is that the reason for this?
<RX14> tilpner, the stdlib isn't precompiled
<RX14> but there is a "prelude"
<RX14> which is required into every program
<RX14> otherwise you would have to require too many things
<RX14> like having to require the gc and default object methods
<RX14> and strings
<RX14> asterite, this is a compiler bug right? https://carc.in/#/r/uv4
<tilpner> So if I copy src/prelude.cr, remove 'require "regex"', and use that as a prelude, libpcre would not be linked?
* tilpner goes and tries that.
<RX14> maybe
<RX14> you can use crystal build --prelude
<tilpner> Nope, no success here. :/
<tilpner> Maybe regex is required somewhere else.
bcardiff has quit [Quit: bcardiff]
shevy has left #crystal-lang ["I'll be back ... maybe"]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ragmaanir has joined #crystal-lang
rok_ has quit [Quit: rok_]
emancu has quit []
bcardiff has joined #crystal-lang
edjsu has quit [Quit: WeeChat 1.2]
ragmaanir has quit [Quit: Leaving]
bcardiff has quit [Quit: bcardiff]
trapped has quit [Ping timeout: 276 seconds]
Philpax has joined #crystal-lang
<RX14> jokke, you around?
edjsu has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 252 seconds]
<BlaXpirit> tilpner, yeah it's probably all throughout the code
<BlaXpirit> cant get rid of regex
Gasher^ has joined #crystal-lang
<tilpner> BlaXpirit - I couldn't get a binary that I compiled on Arch to work on Debian, but I can compile the HelloWorld example on Debian. Why is that?
Gasher has quit [Ping timeout: 252 seconds]
<BlaXpirit> tilpner, does it say anything when it fails>?
<tilpner> "./hello: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory"
<BlaXpirit> uh ok, so that lib is not available
<BlaXpirit> tilpner, what does `ls /usr/lib/libpcre.*` say on debian?
<tilpner> I really don't know what's going on. Give me a second.
<tilpner> On Debian: crystal run hello.cr
<tilpner> >> Error: you've found a bug in the Crystal compiler.
<DeBot> tilpner: Syntax error in eval:21: unexpected token: : - https://carc.in/#/r/uwc
<BlaXpirit> :D
<BlaXpirit> tilpner, welllll what's hello.cr?
<BlaXpirit> there's so much that could go wrong
<tilpner> On Debian as root: crystal run hello.cr >> Hello Crystal!
<tilpner> It's just puts "Hello Crystal!"
<tilpner> Using the Arch-compiled binary on Debian, as root or normal user: ./hello: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
<BlaXpirit> tilpner, yeah I understand, but please run `ls /usr/lib/libpcre.*` on debian
<BlaXpirit> tilpner, are you sure hello.cr isn't owned by root?
<BlaXpirit> (which it might say at the top)
<tilpner> This is the full error log. http://ix.io/uRU
<BlaXpirit> yeah crystal cant use root's folder as normal user. that's on you
<tilpner> cat hello.cr works as a normal user.
<BlaXpirit> tilpner, i don't know. maybe your cache is littered by root-owned things. rm -r ~/.crystal
<BlaXpirit> it shows you the location of the problem
<tilpner> Ah, that worked. Thanks.
<tilpner> Yeah, that one's my fault, sorry. :(
<tilpner> BlaXpirit - Shouldn't libpcre.so be sufficient? http://ix.io/uRV
<BlaXpirit> this might be an older libpcre, who knows
<tilpner> Hmm, my Arch crystal is older than the Debian crystal. Maybe that's the reason for the difference. :7
<BlaXpirit> probably not
<BlaXpirit> tilpner, anyhow, binary compiled on debian works on arch
<BlaXpirit> it's just that arch named it .so.1 with a .so alias (which is the right way) and debian has just .so
<BlaXpirit> and by debian i mean ubuntu :p
<BlaXpirit> that's what i tried on but it's probably the same
<BlaXpirit> bye
<tilpner> Oh yes, it works. Thanks for the explanation! :)
splattael has quit [Quit: Connection closed for inactivity]