shawn42 has quit [Quit: Connection closed for inactivity]
akwiatkowski has quit [Ping timeout: 264 seconds]
<crystal-gh>
[crystal] samueleaton opened pull request #3534: Fix broken link in class.cr documentation (master...fix-broken-class-link) https://git.io/vXKZx
<FromGitter>
<samueleaton> because this is not pretty: `person["pet"]? && person["pet"]["type"]?`
<FromGitter>
<johnjansen> ({} of String => String).keys.each do |key|
<FromGitter>
<samueleaton> No. I don't mean loop through keys, I want to traverse the depth of hash for a specific value. Just the the `get` method in lodash: https://lodash.com/docs/4.16.4#get
<FromGitter>
<johnjansen> Oh sorry I'm 3 beers in and deep frying a turkey right now
<FromGitter>
<wmoxam> Is it 🦃 weekend in the US this weekend?
<FromGitter>
<samueleaton> nope.
<FromGitter>
<wmoxam> ah, 2 more weeks
snsei has quit [Remote host closed the connection]
<FromGitter>
<johnjansen> Early turkey for us
snsei has joined #crystal-lang
jeromegn_ has quit [Ping timeout: 260 seconds]
jeromegn_ has joined #crystal-lang
snsei has quit [Remote host closed the connection]
asterite has quit [Ping timeout: 250 seconds]
jhass has quit [Ping timeout: 260 seconds]
DeBot has quit [Ping timeout: 260 seconds]
jhass has joined #crystal-lang
asterite has joined #crystal-lang
bjz has quit [Ping timeout: 256 seconds]
bjz has joined #crystal-lang
poikon has quit [Ping timeout: 245 seconds]
poikon has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 260 seconds]
p0p0pr37_ is now known as p0p0pr37
pawnbox has joined #crystal-lang
lacour has quit [Quit: Leaving]
DeBot has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
soveran has joined #crystal-lang
akwiatkowski has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 248 seconds]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
poikon has quit [Read error: Connection reset by peer]
poikon has joined #crystal-lang
soveran has quit [Ping timeout: 258 seconds]
j2k has joined #crystal-lang
<j2k>
Hey guys. Should we do our development on 0.19.4 or head?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
j2k has joined #crystal-lang
j2k has quit [Client Quit]
j2k has joined #crystal-lang
j2k has quit [Client Quit]
j2k has joined #crystal-lang
j2k has quit [Client Quit]
j2k has joined #crystal-lang
j2k has quit [Client Quit]
soveran has quit [Remote host closed the connection]
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has quit [Remote host closed the connection]
<BlaXpirit>
samueleaton, `person["pet"]["type"] rescue nil` or `person["pet"]?.try &.["type"]?`
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<FromGitter>
<sdogruyol> @j2k deoenda
<FromGitter>
<sdogruyol> You mean for long term?
<FromGitter>
<sdogruyol> Depends*
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
j2k has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 264 seconds]
soveran has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<raydf> Hi everyone,
<FromGitter>
<raydf> Is there's any way to write the stack trace on rescued exception?
<Papierkorb>
raydf, see Exception#backtrace
<FromGitter>
<raydf> nice, let me try that
<FromGitter>
<raydf> @samueleaton, in person["pet"]["type"] rescue nil, exception throwing is expensive but the code looks pretty :)
<Yxhuvud>
Hmm, crystal doesn't have a implementation of #dig yet?
Raimondii has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
poikon has quit [Ping timeout: 260 seconds]
poikon has joined #crystal-lang
pawnbox has joined #crystal-lang
jhass has quit [Ping timeout: 245 seconds]
asterite has quit [Ping timeout: 252 seconds]
DeBot has quit [Ping timeout: 260 seconds]
Raimondi has quit [Ping timeout: 244 seconds]
asterite has joined #crystal-lang
jhass has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: https://git.io/vXK90
<crystal-gh>
crystal/master 59b600b Ary Borenszweig: Fixed #3529: Stored value type does not match pointer operand type
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<luislavena> @samueleaton `person["pet"].try &.["type"]` There is also jq.cr if the source of data is `JSON::Any`: https://github.com/maiha/jq.cr
<FromGitter>
<luislavena> @samueleaton actually if `pet` key might be optional, do `person["pet"]?.try ...` instead :wink:
pawnbox has quit [Remote host closed the connection]
Raimondi has joined #crystal-lang
j2k has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter>
<samueleaton> @BlaXpirit @luislavena Would those solutions pretty if the hash a a larger depth? ⏎ ⏎ I put together a really simple way to add `get` to the `Hash` class. ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=58274c25e097df7575a17030]
<Yxhuvud>
samueleaton: compare Hash#dig (and for that matter, Array#dig) in Ruby stdlib
perks has joined #crystal-lang
perks has quit [Client Quit]
<FromGitter>
<samueleaton> Awesome! same thing different name. I would rename it to `dig` of course
<Yxhuvud>
well, same rough idea, but different api. Your version doesn't coexist with the array one and doesn't throw error if it cannot dig
<FromGitter>
<samueleaton> Oh. I was modeling mine after the lodash `get` where it is still safe if keys don't exist.
<Yxhuvud>
that kinda makes sense in javascript as all objects can be indexed like that (AFAIK)
<Papierkorb>
what about raising `#dig` and nil-returning `#dig?` ?
soveran has quit [Remote host closed the connection]
<Papierkorb>
Would mirror #[] and #[]? a bit. (Though if having a non-raising version is good or not is a different matter)
<FromGitter>
<samueleaton> Yes! I love that idea with `dig?`
<Yxhuvud>
I wonder why my implementation above doesn't work on HEAD though.
<Yxhuvud>
(unless I define an argumentless dig that doesn't ever get called)
<FromGitter>
<samueleaton> ...but thats running on `0.19.4` as well
<crystal-gh>
[crystal] samueleaton opened pull request #3536: [WIP] Add dig and dig? methods to hash and array (master...hash-dig) https://git.io/vXKFP
<FromGitter>
<samueleaton> I just made a PR where we can continue the discussion #3536
pawnbox has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
kochev has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 248 seconds]
Renich has joined #crystal-lang
Renich has quit [Quit: Lost terminal]
A124 has joined #crystal-lang
kochev has quit [Ping timeout: 260 seconds]
pawnbox has quit [Ping timeout: 260 seconds]
<Papierkorb>
What's the most efficient way of turning a BigInt into a Bytes in network byte order?
<BlaXpirit>
Papierkorb, just make a string :|
<Papierkorb>
BlaXpirit: The protocol mandates a byte representation
<BlaXpirit>
string is a byte representation
<Papierkorb>
in base 256 if you want to get at nomenclature
<BlaXpirit>
there seems to be no sane way
<Papierkorb>
Currently poking at the insane way, which is just a #to_unsafe away
<BlaXpirit>
but then what do you do with that object? there's still no nice access
<BlaXpirit>
mpz_export, eh
<Papierkorb>
Thanks, that method is even better than what I was currently hacking
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 245 seconds]
<Papierkorb>
There we go
akwiatkowski has joined #crystal-lang
kochev has joined #crystal-lang
bjz has joined #crystal-lang
<Yxhuvud>
samueleaton: I see you found the same issue as I did.
akwiatkowski has quit [Ping timeout: 264 seconds]
soveran has joined #crystal-lang
akwiatkowski has joined #crystal-lang
kochev has quit [Ping timeout: 248 seconds]
kochev has joined #crystal-lang
soveran has quit [Remote host closed the connection]
kochev has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
akwiatkowski has quit [Ping timeout: 264 seconds]
optikfluffel has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]