jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.5 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
NeverDie has quit [Read error: Connection reset by peer]
NeverDie has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: http://git.io/v3aMJ
<crystal-gh> crystal/master 522d9f7 Ary Borenszweig: Fix in BACKERS.md
havenwood has joined #crystal-lang
sailorswift has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
blue_deref has quit [Quit: bbn]
rappo has quit [Ping timeout: 244 seconds]
rappo has joined #crystal-lang
epitron has quit [Ping timeout: 246 seconds]
zz_Cidan has quit [Ping timeout: 244 seconds]
trapped has quit [Ping timeout: 245 seconds]
zz_Cidan has joined #crystal-lang
zz_Cidan is now known as Cidan
Cidan has quit [Changing host]
Cidan has joined #crystal-lang
epitron has joined #crystal-lang
strcmp1 has joined #crystal-lang
NeverDie has quit [Read error: Connection reset by peer]
NeverDie has joined #crystal-lang
NeverDie has quit [Max SendQ exceeded]
NeverDie has joined #crystal-lang
elbow has joined #crystal-lang
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sailorswift has joined #crystal-lang
NeverDie has quit [Max SendQ exceeded]
NeverDie has joined #crystal-lang
NeverDie has quit [Max SendQ exceeded]
strcmp1 has quit [Quit: Leaving]
NeverDie has joined #crystal-lang
NeverDie has quit [Max SendQ exceeded]
NeverDie has joined #crystal-lang
<sardaukar> does anyone know how to run crystal once you build it locally?
<sardaukar> I managed to build it, but I get "-lgc not found" errors when I use it
<willl> brew install bdw-gc
<sardaukar> thanks!
<willl> you also might need gmp
<sardaukar> seems to work now
<willl> cool
elbow has quit [Read error: Connection reset by peer]
dbackeus has joined #crystal-lang
dbackeus has quit [Remote host closed the connection]
dbackeus has joined #crystal-lang
BlaXpirit has joined #crystal-lang
jbye has quit [*.net *.split]
adam12 has quit [*.net *.split]
shadeslayer has quit [*.net *.split]
tliff has quit [*.net *.split]
yie has quit [*.net *.split]
wmoxam has quit [*.net *.split]
asbradbury has quit [*.net *.split]
pleiosaur has quit [*.net *.split]
jbye has joined #crystal-lang
adam12 has joined #crystal-lang
shadeslayer has joined #crystal-lang
tliff has joined #crystal-lang
asbradbury has joined #crystal-lang
wmoxam has joined #crystal-lang
yie has joined #crystal-lang
pleiosaur has joined #crystal-lang
adam12 has quit [Ping timeout: 265 seconds]
tliff has quit [Ping timeout: 265 seconds]
asbradbury has quit [Ping timeout: 265 seconds]
pleiosaur has quit [Ping timeout: 265 seconds]
jbye has quit [Ping timeout: 256 seconds]
shadeslayer has quit [Ping timeout: 256 seconds]
yie has quit [Ping timeout: 256 seconds]
wmoxam has quit [Ping timeout: 256 seconds]
asbradbury has joined #crystal-lang
pleiosaur has joined #crystal-lang
jbye has joined #crystal-lang
wmoxam has joined #crystal-lang
yie has joined #crystal-lang
shadeslayer has joined #crystal-lang
adam| has joined #crystal-lang
tliff has joined #crystal-lang
lokulin has quit [Ping timeout: 260 seconds]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lokulin has joined #crystal-lang
zamith has joined #crystal-lang
<zamith> asterite: Saw this article and thought it might be of interest to you: http://lib.dr.iastate.edu/cgi/viewcontent.cgi?article=1089&context=cs_techreports
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
kyrylo has joined #crystal-lang
leafybasil has quit [Ping timeout: 255 seconds]
cina has joined #crystal-lang
<cina> crystal beginner question: how do I cast a string to integer? str.to_i works in Ruby, but not in Crystal. Or if str is always a String, how do I parse the integer in a new variable?
leafybasil has joined #crystal-lang
<cina> can't find this in the docs
<jhass> >> "123".to_i
<DeBot> jhass: # => 123 - http://carc.in/#/r/b5p
<jhass> seems to work fine, what's your error?
<jhass> cina: ^
<cina> jhass: thank! >> "123$".to_i
<cina> >> "123$".to_i
<DeBot> cina: ArgumentError: invalid Int32: 123$ - more at http://carc.in/#/r/b5r
<cina> But it works in Ruby
<jhass> well yes, that's intentional, crystal has chosen to be more exact here
<jhass> just mangle your string into something parsable
<jhass> >> "123$"[/\d+/].to_i
<DeBot> jhass: # => 123 - http://carc.in/#/r/b5s
<cina> jhass: thank you!
<cina> I like this approach, it's a good idea to be more exact
<jhass> So String#to_i is closer to Ruby's Kernel#Integer
<cina> interesting... Kernel#Integer: "strings should be strictly conformed to numeric representation"
<jhass> oh, actually
<jhass> >> "123$".to_i(strict: false)
<DeBot> jhass: # => 123 - http://carc.in/#/r/b5t
<jhass> I always forget the tons of options to #to_i ...
<jhass> >> "123$".to_i?
<DeBot> jhass: # => nil - http://carc.in/#/r/b5u
<cina> cool! is this documented anywhere? or did you look at the source to learn about this?
<jhass> well, crystal-lang.org/api does list the method(s) and their parameters
<jhass> no explicit doc text for it yet, contributions welcome ;)
<cina> thanks :)
<cina> one more thing I noticed different from Ruby, perhaps it's intentional as well: String#scan
<jhass> it does yield MatchData's, yeah
<cina> jhass: thanks, it's fun learning a new language that is so similar to a language I already know
<jhass> :)
<cina> I'm re-writing some of my little ruby script to crystal, e.g. a script for setting tmux's status bar
zamith_ has joined #crystal-lang
zamith has quit [Quit: Be back later ...]
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
zamith_ has quit [Read error: Connection reset by peer]
zamith_ has joined #crystal-lang
<cina> Is there any way to assign a string literal in Crystal? like single-quotes in Ruby
<jhass> a = "foo"
<jhass> or you mean to display interpolation?
<jhass> er
<jhass> disable
<cina> yes, disable interpolation
<jhass> just escape it
<jhass> >> "foo \#{bar}"
<DeBot> jhass: # => "foo \#{bar}" - http://carc.in/#/r/b5y
<jhass> >> puts "foo \#{bar}"
<DeBot> jhass: foo #{bar} - more at http://carc.in/#/r/b5z
<cina> oh ok, in Go we have backquotes, I thought there might be a convenient way to do it in crystal as well
<jhass> IME it's very rare that you need a string with a lot of #{...} things in it
<cina> true, me too, I thought of this because I was running a tmux command, tmux formatting has a similar syntax, e.g. tmux ls -F '#{session_name}:#{window_index}'
<cina> not important, I could escape that :)
<jhass> I see
<jhass> >> macro no_interpol(string); {{string.stringify.gsub(/\#{/, "\\\#{").id}}; end; puts no_interpol "hey #{1+1} yo"
<DeBot> jhass: hey #{1 + 1} yo - more at http://carc.in/#/r/b6b
<jhass> :P
<cina> :D
<cina> jhass: very cool!
<cina> nice use of macro
<jhass> don't think I'd use it in real code, but ... ;)
<cina> I think it's good enough for my usecase, because I control the input, and there is no unpredictable user iput
<jhass> well, interpolation won't happen in user input every anyway
<jhass> *ever
<cina> oh you are right, I was thinking of passing user input to the macro, but it would be unnecessary
<jhass> you can't even pass user input to the macro, it's run at compile time ;)
sleeper_ is now known as sleeper
<cina> jhass: hmm, but this seems to work: no_interpol gets
<cina> aha, you mean inside the macro definition?
<jhass> it just copies the method invocation
<jhass> mmh, how do I show this...
<jhass> >> macro foo(bar); {{bar.stringify}}; end; foo(gets)
<DeBot> jhass: # => "gets" - http://carc.in/#/r/b6c
<jhass> >> def baz; 1; end; macro foo(bar); {{bar.stringify.id}}; end; foo(baz)
<DeBot> jhass: # => 1 - http://carc.in/#/r/b6d
<jhass> >> macro foo(bar); {{bar.class_name}}; end; foo(gets)
<DeBot> jhass: # => "Call" - http://carc.in/#/r/b6e
<cina> jhass: what does #id do in your macro?
<jhass> basically the opposite of .stringify, remove any quoting
<jhass> >> {{"1235".id}}.class
<DeBot> jhass: # => Int32 - http://carc.in/#/r/b6f
<jhass> >> {{"puts".id}} "hi"
<DeBot> jhass: Syntax error in eval:4: unexpected token: DELIMITER_START - http://carc.in/#/r/b6g
<jhass> eh
<jhass> >> {{"puts(1)".id}}
<DeBot> jhass: 1 - more at http://carc.in/#/r/b6h
<cina> thanks!
<BlaXpirit> strange name though
<cina> now I see what you meant by copying the method invokation... so in case of no_interpol(gets), the string being escaped is just "gets", so we are basically returning the result of gets without any changes made to it
<cina> oops, invocation*
<vegai> is debot's source available somewhere?
<jhass> cina: exactly
<jhass> vegai: yes, jhass/DeBot
<vegai> jhass: thank you
<jhass> note it's written agains 0.6.1 still
<vegai> ah
<vegai> I'll see if I'm able to update it to 0.7.5
<jhass> you might want to look at https://github.com/Thor77/crystal_irc
<vegai> ah, I see. pthreads
<vegai> jhass: is the window for permanent rewards via donations closed? The bountysource thing?
<jhass> I guess so
<jhass> though I'm sure there are some opportunities if you talk to asterite or waj ;)
<BlaXpirit> is there any reasonable deque implementation?
trapped has joined #crystal-lang
jhass has quit [Excess Flood]
jhass has joined #crystal-lang
NeverDie has joined #crystal-lang
NeverDie_ has joined #crystal-lang
NeverDie has quit [Ping timeout: 245 seconds]
<trapped> `ERROR: Missing hash value: "HomeController"` -> https://gist.github.com/trapped/265d1fb0a926f55125a5
NeverDie_ has quit [Quit: I'm off to sleep. ZZZzzz…]
<dbackeus> trapped: I seem to recall namespaced controllers being problematic in amethyst
<dbackeus> could that be the problem?
sleeper is now known as sleeper_
zamith_ is now known as zamith
<BlaXpirit> how does GC work with values stored in Pointer? why does Array need to call clear? https://github.com/manastech/crystal/blob/master/src/array.cr#L469
<jhass> so the references are gone?
<jhass> https://github.com/manastech/crystal/blob/master/src/array.cr#L102 memory allocated that way is searched for pointers to live objects by the GC
<BlaXpirit> jhass, does that mean if I store a number in it that happens to match some memory location, it won't be cleared?
<BlaXpirit> i dont get it
<jhass> ugh, no idea but I doubt it
<BlaXpirit> hm actually it kinda makes sense. why would i store a number inside Pointer(Reference)
<BlaXpirit> and Pointer(Value) wouldn't count for GC
<BlaXpirit> i just wasn't expecting GC to work even with the lowest-level data type
<asterite> hi vegai
Dreamer3 has joined #crystal-lang
<asterite> In fact for pointers of primitive types like Int32 and so on we should be using malloc_atomic so the GC doesn't scan pointers there. And the `clear` shouldn't be done in that case. Right now it's doing the safest thing but not the fastest
dbackeus has quit [Remote host closed the connection]
dbackeus has joined #crystal-lang
waj has joined #crystal-lang
<trapped> @matched_route.controller is a string
<trapped> the name of the class
<trapped> excluding the module
<trapped> while @controllers contains the full name
<trapped> (including the module)
<trapped> so .fetch fails
<trapped> i guess this should be changed to something that includes the module name https://github.com/Codcore/amethyst/blob/master/src/amethyst/dispatch/router.cr#L13
havenwood has joined #crystal-lang
waj_ has joined #crystal-lang
dbackeus has quit [Remote host closed the connection]
waj has quit [Ping timeout: 260 seconds]
waj_ is now known as waj
<BlaXpirit> in order to implement an efficient iterator, i need access to an object's internals. is there any solution to this?
<jhass> you can access instance vars with obj.@foo, but usually there's a better way
<jhass> like exposing the efficient operations as regular (delegating) methods or handing some internal explicitly to the iterator
<BlaXpirit> jhass, so instance vars aren't private????
<jhass> well, kinda, .@foo is more meant for introspection
<jhass> it's a big fat "I'm nasty" sign to use them
<jhass> hence they don't appear in the docs or anything
blue_deref has joined #crystal-lang
sleeper_ is now known as sleeper
waj has quit [Quit: waj]
waj has joined #crystal-lang
zamith has quit [Quit: Be back later ...]
<asterite> BlaXpirit: in a language where you can reopen a class and expose an instance variable, having a syntax for accessing them "in a hurry" isn't that dangerous, I think. They are "public" now just temporarily, they'll probably only be accessible from within the same class in the future
<BlaXpirit> asterite, that's ok, but then how do i make an iterator? even c++ has friend classes
<asterite> an iterator over what?
shama has joined #crystal-lang
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 240 seconds]
waj_ is now known as waj
<dzv> perhaps disable access to obj.@var when --release is passed?
<jhass> I'd still love something like macro method_missing that overloads on arguments, class Object macro_method instance_variable_get(name); @{{name.id}}; end; end; class Foo; def initialize; @foo = 1; @bar = 2; end; end; end; Foo.new.instance_variable_get :foo; Foo.new.instance_variable_get :bar; -> generates Foo#instance_variable_get_tmp123, Foo#instance_variable_get_tmp234
<jhass> something into that direction
strcmp1 has joined #crystal-lang
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 265 seconds]
waj_ is now known as waj
NeverDie has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
sleeper is now known as sleeper_
dbackeus has joined #crystal-lang
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 260 seconds]
waj_ is now known as waj
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
NeverDie has joined #crystal-lang
dbackeus has quit [Remote host closed the connection]
dbackeus has joined #crystal-lang
waj_ has joined #crystal-lang
waj has quit [Ping timeout: 240 seconds]
waj_ is now known as waj
blue_deref has quit [Quit: bbn]
sleeper_ is now known as sleeper
sleeper is now known as sleeper_
NeverDie has quit [Max SendQ exceeded]
NeverDie has joined #crystal-lang
waj_ has joined #crystal-lang
waj_ has quit [Remote host closed the connection]
waj has quit [Ping timeout: 245 seconds]
NeverDie has quit [Max SendQ exceeded]
leafybasil has joined #crystal-lang
NeverDie has joined #crystal-lang
kyrylo has quit [Remote host closed the connection]
strcmp1 has quit [Quit: Leaving]
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/v3izp
<crystal-gh> crystal/master 5d398a0 Ary Borenszweig: Some refactors, optimizations and simplifications in bcrypt
<crystal-gh> crystal/master eb13f75 Ary Borenszweig: Crystal 0.7.6
NeverDie has quit [Max SendQ exceeded]
<travis-ci> manastech/crystal#eb13f75 (master - Crystal 0.7.6): The build passed. https://travis-ci.org/manastech/crystal/builds/75514099
<crystal-gh> [crystal] PragTob opened pull request #1173: Add Iterator#in_groups_of (master...implement-iterator-in-groups-of) http://git.io/v3ioB
dbackeus has quit [Remote host closed the connection]
NeverDie has joined #crystal-lang
BlaXpirit has quit [Quit: Konversation]
jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.6 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
<crystal-gh> [crystal] waj pushed 1 new commit to master: http://git.io/v3idf
<crystal-gh> crystal/master 3fe0540 Juan Wajnerman: Reinitialize the event_base after fork (fixes #600)
havenwood has joined #crystal-lang
<jhass> stugol needs to calm down -.-
<travis-ci> manastech/crystal#3fe0540 (master - Reinitialize the event_base after fork (fixes #600)): The build passed. https://travis-ci.org/manastech/crystal/builds/75523081
NeverDie has quit [Max SendQ exceeded]
NeverDie has joined #crystal-lang
havenwood has quit [Ping timeout: 246 seconds]