ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.4 | 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
Jomakasi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 246 seconds]
triangles2 has joined #crystal-lang
triangles has quit [Ping timeout: 260 seconds]
<FromGitter> <drosehn> Could someone remind me of a standard trick? I'm trying to do the following command, and it's failing because the second reference to instance-variable `@locationKey` *could* be nil. I understand why crystal complains about that, and I know there was a standard shorthand-way to avoid it, but I can't remember what the shorthand is. The example statement is:
<FromGitter> <drosehn> `lsize = @locationKey.nil? ? 0 : @locationKey.size`
<FromGitter> <drosehn> presumably what I'm looking for is some shorthand for `try`, but I can't seem to find it at the moment.
<FromGitter> <johnjansen> not_nil!
<FromGitter> <johnjansen> `lsize = @locationKey.nil? ? 0 : @locationKey.not_nil!.size` i think ;-)
<FromGitter> <drosehn> My memory on it is vague because I've never used it, but I think it was something shorter than that.
<FromGitter> <drosehn> For now I've gone with: `lsize = (dcpy = locationKey).nil? ? 0 : dcpy.size`
<FromGitter> <johnjansen> @locationKey.try &.size perhaps
<FromGitter> <drosehn> ah, yeah, that's probably it.
pawnbox has joined #crystal-lang
matp has quit [Quit: Bye!]
matp has joined #crystal-lang
pawnbox has quit [Ping timeout: 265 seconds]
<FromGitter> <johnjansen> @drosehn did you get it ? `lsize = locationKey.try &.size || 0`
<FromGitter> <drosehn> I did try it, and it does work. But I think I'll stick with the dumb-copy for now. There are times when I'll test a few lines of code by copy&pasting it into `irb`, and the dumb-copy works in ruby but the `try &` shorthand doesn't.
<FromGitter> <drosehn> However I'm at least going to put that method in as comments, so I can find it the next time I'm looking for it! :smile:
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
hako_ has quit [Ping timeout: 245 seconds]
hako_ has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
<FromGitter> <jwoertink> Is it weird that this fails? https://play.crystal-lang.org/#/r/1dlp but this works https://play.crystal-lang.org/#/r/1dlo ?
<FromGitter> <jwoertink> I have trouble figuring out what is a language bug VS what is my error :/
<FromGitter> <cjgajard> since in `1dlo` THINGS is a array-literal its value can be known at compile-time
pawnbox has joined #crystal-lang
<FromGitter> <jwoertink> So the class method, even though it's an array literal, it's not really ran until runtime?
pawnbox has quit [Ping timeout: 248 seconds]
<FromGitter> <jwoertink> hmm.. damn, looks like this doesn't work either https://play.crystal-lang.org/#/r/1dlt
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]
hako_ has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
hako_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
shawn42 has quit [Quit: Connection closed for inactivity]
lacour has quit [Quit: Leaving]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 248 seconds]
A124 has quit [Ping timeout: 252 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei has joined #crystal-lang
bjz has joined #crystal-lang
snsei has quit [Ping timeout: 244 seconds]
bjz has quit [Read error: Connection reset by peer]
pawnbox has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
soveran has joined #crystal-lang
bjz has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]
pawnbox has joined #crystal-lang
soveran 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
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
bjz has quit [Read error: Connection reset by peer]
pawnbox has quit [Remote host closed the connection]
vasilakisfil has joined #crystal-lang
<vasilakisfil> anyone knows how I can start kemal with multiple pre-forked processes ?
<BlaXpirit> vasilakisfil, uhh i'm not sure if that would work
<BlaXpirit> maybe you can put multiple instances behind a reverse proxy
<vasilakisfil> ok then this means that we can't exploit the whole memory of a dyno
<vasilakisfil> I will take a look at the reverse proxy
<BlaXpirit> vasilakisfil, just because i don't know doesn't mean it's impossible
pawnbox has joined #crystal-lang
<vasilakisfil> ok
bjz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
bjz has quit [Ping timeout: 240 seconds]
bjz_ has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
[spoiler] has joined #crystal-lang
[spoiler] has quit [Client Quit]
[spoiler] has joined #crystal-lang
hako_ has quit [Ping timeout: 260 seconds]
[spoiler] has quit [Quit: Cheers!]
[spoiler] has joined #crystal-lang
bmcginty has quit [Ping timeout: 252 seconds]
bmcginty has joined #crystal-lang
akwiatkowski 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]
bmcginty has quit [Ping timeout: 258 seconds]
bmcginty has joined #crystal-lang
shawn42 has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
akwiatkowski has quit [Quit: Konversation terminated!]
akwiatkowski has joined #crystal-lang
akwiatkowski has quit [Client Quit]
soveran has joined #crystal-lang
A124 has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]
akwiatkowski has joined #crystal-lang
snsei has joined #crystal-lang
pawnbox has joined #crystal-lang
<FromGitter> <vivus-ignis> do macros work in the playground? trying to get an object's methods does not work: undefined method 'methods'
<FromGitter> <vivus-ignis> or maybe someone can suggest a better way to introspect using playground
<RX14> @vivus-ignis there isn't a methods macro by default
<RX14> you should take a look at the docs for the typr
<FromGitter> <vivus-ignis> RX14, thanks. i've read that already though
Philpax has quit [Ping timeout: 260 seconds]
emancu has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
triangles3 has joined #crystal-lang
triangles2 has quit [Ping timeout: 248 seconds]
snsei has quit [Remote host closed the connection]
vasilakisfil has quit [Quit: Konversation terminated!]
Raimondi has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 260 seconds]
mark_66 has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei has joined #crystal-lang
w400z has quit [Quit: Textual IRC Client: www.textualapp.com]
snsei has quit [Ping timeout: 250 seconds]
emancu has quit []
triangles3 has quit [Quit: Leaving]
soveran has joined #crystal-lang
<FromGitter> <crisward> Is anyone working on a test coverage tool for crystal?
<FromGitter> <johnjansen> @crisward, @asterite is the person to ask
soveran has quit [Ping timeout: 256 seconds]
<FromGitter> <crisward> @johnjansen thanks... I think I know the answer the issue was raised a year ago on github, I'm guessing it's not a priority.
<FromGitter> <johnjansen> itll be http://llvm.org/docs/CommandGuide/llvm-cov.html im guessing
<FromGitter> <crisward> any idea how that'd be used with crystal?
<FromGitter> <johnjansen> None im afraid
<maxpowa> is it possible to specify regex flags when using %r() ?
<FromGitter> <drosehn> I think so. Just put them after the closing character. Seems to me I've done that.
<maxpowa> so %r(^word$)x should work?
<maxpowa> appears to compile
<maxpowa> yup thats working
<maxpowa> thanks
perks has joined #crystal-lang
vikaton has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
snsei has joined #crystal-lang
bjz has joined #crystal-lang
snsei has quit [Ping timeout: 268 seconds]
pawnbox has quit [Remote host closed the connection]
<Papierkorb> Does someone have a travis recipe to use crystal HEAD?
<BlaXpirit> i had to have had it
<BlaXpirit> nope, i scrapped the idea
<BlaXpirit> but my draft did survive. Papierkorb, https://bpaste.net/show/0543a76338e7
<Papierkorb> BlaXpirit: Thanks, will maybe add it later this week
soveran has joined #crystal-lang
p0p0pr37 has quit [Read error: Connection reset by peer]
p0p0pr37 has joined #crystal-lang
vonKingsley has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pduncan has quit [Ping timeout: 260 seconds]
<vonKingsley> quick Q, I'm reviewing macros and curious if there are there any other instance variables, or is @type the only one?
<BlaXpirit> vonKingsley, there are none (99% sure)
<vonKingsley> Thanks, i searched around and couldnt find any, but figured i would ask
vonKingsley has quit [Quit: Page closed]
<FromGitter> <drosehn> I'm working with the JSON support for the first time. The `mapping()` macro combined with ".from_json" method has saved me a ton of work. The one thing I can't figure out is how I could set `strict = true`. I'm reading in a file of json objects which was written out by a program that I have no documentation for, so I want to know if my code has missed some field in that object.
<Papierkorb> drosehn, JSON.mapping({ foo: String, ... }, strict: true)
<FromGitter> <drosehn> Huh. I didn't realize I was supposed to have curly-braces in there. Let me try that.
<FromGitter> <drosehn> Yes! Thanks muchly!
<Papierkorb> cheers
<RX14> you don't need curly braces
<FromGitter> <drosehn> (and yes, there is at least one field that I had overlooked)
<RX14> but you do need them if you specify strict: true
<FromGitter> <drosehn> Ah.
Philpax has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 264 seconds]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
<FromGitter> <drosehn> Yep, that worked nicely. And these are files with thousands of lines, and some of those lines are > 4000 characters. Kinda hard to eyeball them to see what fields are defined!
vikaton has quit [Quit: Connection closed for inactivity]