ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
duane has joined #crystal-lang
duane has quit [Ping timeout: 244 seconds]
duane has joined #crystal-lang
ht_ has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
duane has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
teardown has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
sorcus has joined #crystal-lang
absolutejam has joined #crystal-lang
absolutejam1 has quit [Quit: WeeChat 2.5]
<absolutejam> what's the easiest way of saying `if foo in array`?
<absolutejam> basically, what's a method or `in` on an Enumerable?
<absolutejam> includes?
DTZUZO has quit [Ping timeout: 258 seconds]
waheedi has joined #crystal-lang
<waheedi> whats up folks, any guidelines to start contributing to crystal?
early has quit [Quit: Leaving]
early has joined #crystal-lang
absolutejam has quit [Ping timeout: 248 seconds]
absolutejam has joined #crystal-lang
absolutejam1 has joined #crystal-lang
<absolutejam> can I return from a block?
<absolutejam> so I have a `func` property that I capture from a block
<absolutejam> and then I call it with @func.call()
<absolutejam> I want to return the value from that call, but in the method that calls that, it doesn't return the value from the block
<sorcus> @absolutejam for array you can use `[1,2,3].includes? 2`.
<absolutejam> ty
<absolutejam> ohhh, my Proc has output type of Nil
<absolutejam> derp
<Yxhuvud> absolutejam: You can use `next` or `break` depending on what you want to acheive.
<Yxhuvud> .. but then the actual problem was about a Proc and not about blocks x_x
<absolutejam> how can I go about cloning an object?
<absolutejam> I'm trying .dup but it looks like the second object is getting mutated too, possibly because of nested objects
<absolutejam> there's a `.def_clone` macro but no `.clone` method?
<jokke> hey
<jokke> is it ever possible to pass structs by reference?
<jokke> absolutejam: you just call def_clone in your class
<jokke> then you'll have a clone method
<absolutejam> so I have to define the clone behaviour? :|
<absolutejam> and what about if I have nested mutable data structures?
<Yxhuvud> jokke: you can create a Pointer to it.
<Yxhuvud> But that is threading unsafe territory. But in general, if you want to pass something by reference, then you use an object. That is *the* big difference between structs and objects.
<jokke> yeah
<jokke> i just switched to objects
<jokke> *classes
<jokke> i need to mutate them so it's much more straight forward that way
<jokke> and probably even faster
<jokke> because i pass them around a lot
<jokke> and they're nested structures
lucasb has joined #crystal-lang
absolutejam has quit [Ping timeout: 272 seconds]
alex`` has joined #crystal-lang
absolutejam has joined #crystal-lang
waheedi has quit [Quit: waheedi]
absolutejam has quit [Quit: WeeChat 2.5]
absolutejam has joined #crystal-lang
<absolutejam1> can I define `puts` on my class and then still access the Kernel(?) puts?
<dingenskirchen> try `::puts "whatever"`
<absolutejam1> weet, thanks
<absolutejam1> sweet*
<absolutejam1> I was getting a stack overflow because it was recursing, haha
absolutejam has quit [Ping timeout: 245 seconds]
duane has joined #crystal-lang
absolutejam has joined #crystal-lang
DTZUZO has joined #crystal-lang
ht_ has joined #crystal-lang
absolutejam has quit [Ping timeout: 244 seconds]
<jokke> hey there i'm stuck on this for hours now... maybe you can help. Any idea what's happening here? https://carc.in/#/r/78zm
<jokke> oh shit
<jokke> open since forever
<robacarp> _for_ev_er
waheedi has joined #crystal-lang
waheedi has quit [Client Quit]
waheedi has joined #crystal-lang
waheedi has quit [Ping timeout: 245 seconds]
absolutejam has joined #crystal-lang
mntmn has quit [Ping timeout: 258 seconds]
issyl0 has quit [Ping timeout: 258 seconds]
issyl0 has joined #crystal-lang
mntmn has joined #crystal-lang
waheedi has joined #crystal-lang
absolutejam has quit [Ping timeout: 248 seconds]
absolutejam has joined #crystal-lang
devil_tux has quit [Ping timeout: 268 seconds]
laaron has quit [Remote host closed the connection]
absolutejam has quit [Ping timeout: 248 seconds]
duane has quit [Ping timeout: 244 seconds]
waheedi has quit [Quit: waheedi]
bars0 has joined #crystal-lang
bars0 has quit [Client Quit]
absolutejam has joined #crystal-lang
waheedi has joined #crystal-lang
alex`` has quit [Ping timeout: 258 seconds]
<absolutejam> what happened to the gitter link?
duane has joined #crystal-lang
<dingenskirchen> gitter bridge died on this end some days ago
<absolutejam> :[
<absolutejam> How do I use `logger`? Globals are gone, right?
<absolutejam> if I declare it outside of my module as `log`, I can't see `log` inside the module
DTZUZO has quit [Ping timeout: 245 seconds]
<dingenskirchen> I defined my logger as a constant before any other init code
<absolutejam> how do you mean?
<dingenskirchen> that's the file that first "executes"
<dingenskirchen> it defines the logger, a shutdown handler, and hands over to the main code
<dingenskirchen> in the main code I can use the logger as `Log`, anywhere.
<absolutejam> does that play well with modules though?
<dingenskirchen> wdym?
<absolutejam> can you still access it within a module via. `Log.debug`?
<dingenskirchen> yep
<absolutejam> oh, the capital at the start - that does some magi right?
<absolutejam> magic*
<dingenskirchen> that's just a constant
<dingenskirchen> not much in the magic department ^^
<absolutejam> Oh right, thought constants were all caps; guess that's just convention
<dingenskirchen> yuh
ht_ has quit [Remote host closed the connection]
sorcus has quit [Ping timeout: 250 seconds]
waheedi has quit [Quit: waheedi]
duane has quit [Ping timeout: 245 seconds]
DTZUZO has joined #crystal-lang
absolutejam has quit [Ping timeout: 268 seconds]
Raimondi has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang