ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.32.1 | 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
<FromGitter> <tenebrousedge> JS is such rancid garbage
<sorcus> No one love JS :-D
teardown has quit [Read error: Connection reset by peer]
teardown has joined #crystal-lang
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 260 seconds]
<FromGitter> <rishavs> i love js :(
<sorcus> rishavs: Don't worry, JS not bad :-)
<sorcus> rishavs: But for me JS has one thing that i little hate... HTTP requests :-D
<FromGitter> <rishavs> I love how json is a 1st class citizen in js. no other language that I have used has that simplicity
<FromGitter> <craysiii> What is a hash then?
<FromGitter> <Blacksmoke16> a pita for the most part :p
alex`` has quit [Ping timeout: 265 seconds]
<FromGitter> <tenebrousedge> > I love how json is a 1st class citizen in js. no other language that I have used has that simplicity ⏎ ⏎ Is this sarcasm?
<FromGitter> <tenebrousedge> or some other form of parody?
Flipez2 is now known as Flipez
flaviodesousa has quit [Quit: KVIrc 4.9.3 Aria http://www.kvirc.net/]
yukai has quit [Ping timeout: 268 seconds]
<FromGitter> <grkek> Death penalty for the JS pleb
_ht has joined #crystal-lang
_ht has quit [Quit: _ht]
<FromGitter> <Daniel-Worrall> Please be respectful to people.
Liothen has quit []
Liothen has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter> <rurounijones_gitlab> Ahoi all. I have a Channel setup as a queue. It accepts different event types (Update, Delete, SetProperty). Each event is a NamedTuple alias with different fields. In the reader of this channel I am trying to direct the events to their respective by using a `case` statement based on `event.class` but the compiler is complaining about the fact that I have code, that is only called for the Update
<FromGitter> ... event, is looking for keys in the Delete event. My thought was that, since this code is never called for a Delete event, the compiler should know that and not complain. Is my thinking correct?
<FromGitter> <rurounijones_gitlab> (I am porting the code from Ruby hence the use of NamedTuples since the original was just passing hashes around. It would not be a complete pain to switch to using actual classes instead of aliases, I just want to know if I am wrong in my assumptions)
<FromGitter> <rurounijones_gitlab> Ah, reading the docs more, I don't think `alias` actually matters at compile time so the `case` statement is bunk since all it sees is `NamedTuple`, not the alias name
<FromGitter> <rurounijones_gitlab> and just to finish off for posterity. I believe it is `typeof(T)`, not `T.class` - not that it works for my use-case anyway.
alex`` has quit [Quit: WeeChat 2.7]
alex` has joined #crystal-lang
alex` is now known as Guest91680
Guest91680 is now known as alex``
bazaar has joined #crystal-lang
<FromGitter> <rurounijones_gitlab> Ok, even switching to sending events in fully defined classes I am still getting this behavour. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ `Error: undefined method 'data' for TacScribe::ReferenceLatitudeSettingEvent (compile-time type is (TacScribe::ReferenceLatitudeSettingEvent | TacScribe::ReferenceLongitudeSettingEvent | TacScribe::UnitDeletionEvent | TacScribe::UnitUpdateEvent))`
<FromGitter> <rurounijones_gitlab> And again for posterity. `typeof` was not needed as `case` uses the `===` operator and from the docs "For example, Class defines case equality as when an object is an instance of that class,". No idea if this would have worked with `alias` but I am not going to rewrite the code to check.
alex`` has quit [Ping timeout: 268 seconds]
alex`` has joined #crystal-lang
<FromGitter> <tenebrousedge> :plus1:
<FromGitter> <tenebrousedge> @rurounijones_gitlab ⏎ ⏎ ```[1].class #=> Array ⏎ typeof([1]) #=> Array(Int32)``` [https://gitter.im/crystal-lang/crystal?at=5e303c96f6945f41ef2f952e]
duane has joined #crystal-lang
issyl0 has quit []
issyl0 has joined #crystal-lang
<repo> there's no version of JSON::Any#dig that would accept an array as subkeys?
<repo> so if i had a runtime input like "foo.bar.baz" i'd need to manually dig?
<FromGitter> <tenebrousedge> hmmmm, maybe `reduce`
<repo> yeah
<FromGitter> <tenebrousedge> ```arr.reduce(json) {|m, e| m.dig(e) }```
<repo> yeah
<repo> or for nilable stuff arr.reduce(json) { |m, e| m.try(&.[]? e) }
<repo> or dig i guess
<repo> *dig?
<FromGitter> <tenebrousedge> and for the obnoxious null issue: `arr.reduce(json) {|m, e| m.dig?(e) rescue m }`
_ht has joined #crystal-lang
alex`` has quit [Ping timeout: 265 seconds]
alex`` has joined #crystal-lang
<FromGitter> <christopherzimmerman> For any baseball junkies out there, I'm working on a retrosheet play-by-play parser. Currently able to parse about 6300 games per second.
fauno has quit [Ping timeout: 265 seconds]
fauno has joined #crystal-lang
alex`` has quit [Ping timeout: 265 seconds]
alex`` has joined #crystal-lang
JuanMiguel has joined #crystal-lang
JuanMiguel has quit [Client Quit]
_ht has quit [Quit: _ht]
duane has quit [Ping timeout: 268 seconds]
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 265 seconds]
gangstacat has quit [Quit: Ĝis!]
yukai has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Anyone used an rss feed builder on Crystal?
alex`` has quit [Ping timeout: 268 seconds]