<FromGitter>
<mixflame> thanks. I found at_exit only runs when "exit" is called
<FromGitter>
<Blacksmoke16> ah, makes sense
sagax has quit [Remote host closed the connection]
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 272 seconds]
sagax has joined #crystal-lang
Vexatoast has quit [Quit: ZNC Quit]
Vexatos has joined #crystal-lang
Vexatos has quit [Ping timeout: 246 seconds]
Vexatos has joined #crystal-lang
duane has quit [Ping timeout: 264 seconds]
frojnd has quit [Quit: WeeChat 2.3]
deavmi has quit [Ping timeout: 272 seconds]
alexherbo2 has joined #crystal-lang
deavmi has joined #crystal-lang
jetpack_joe has quit [Ping timeout: 246 seconds]
<FromGitter>
<alexherbo2> I forgot how to pass method with argument
<FromGitter>
<alexherbo2> on map for example
<FromGitter>
<alexherbo2> without block
jetpack_joe has joined #crystal-lang
deavmi has quit [Quit: Eish! Load shedding.]
<FromGitter>
<throwaway4rust> Jesus I got so disappointed yesterday. I was trying a project in crystal but had to install it in ubuntu on multipass on Windows
<FromGitter>
<throwaway4rust> i really wish Crystal can get the Windows version out :/
<FromGitter>
<asterite> I don't think it's intuitive
<FromGitter>
<asterite> and it's a very specific use case
<FromGitter>
<asterite> the proposal for short block syntax is more general and way more useful
<FromGitter>
<j8r> maybe... but it the feature is a light addition, it would be definitely a nice to have
deavmi has joined #crystal-lang
rocx has joined #crystal-lang
<FromGitter>
<asterite> it really depends... we can add a thousand little features, or just one feature that solves all of those issues
duane has joined #crystal-lang
<raz>
after glancing over that PR i have to agree with "too cryptic". for smallbrainers like myself even the regular block syntax & semantics can be quite confusing at times.
<raz>
with a shorthand like that i'd prob be tempted to use it, only to hurt myself when i try to understand the code again later
<FromGitter>
<j8r> it is quite similar of how other languages work, like Python
<FromGitter>
<j8r> this syntax already exists in crystal, the deal was only to not have to add argument types
<FromGitter>
<j8r> `&->File.exists?(String)` (already valid) to `&->File.exists?`
<FromGitter>
<naqvis> imho, its because procs are not first class citizen yet, so have to go through this whole fuss of annotating the param types. In other languages methods/funcs are first class citizen
<FromGitter>
<naqvis> tbh passing procs as params is already too cryptic
<FromGitter>
<naqvis> so hope in future, passing methods are args will become easier as other languages offer
alexherbo2 has quit [Ping timeout: 264 seconds]
<FromGitter>
<asterite> procs are first class citizen, they just need an explicit type
<FromGitter>
<asterite> for example in Elixir you need to do `&foo/1` or `&foo/2` to mention the arity. That doesn't mean they are not first class citizen, but you need to disambiguate based on number of arguments. Here it's the same except you also need to specify the type
<FromGitter>
<naqvis> Thanks Ary for clarification. For overloaded methods it does make sense to disambiguate, but shouldn't be the case for others. Since procs are function pointers, so at the time of definition, things are already defined, then compiler shouldn't be instructed again on the very same.
commavir_ has joined #crystal-lang
psydroid has quit [*.net *.split]
commavir has quit [*.net *.split]
commavir_ is now known as commavir
ryanprior has quit [Write error: Connection reset by peer]
return0e[m] has quit [Read error: Connection reset by peer]
hamoko[m] has quit [Remote host closed the connection]
hamoko[m] has joined #crystal-lang
<raz>
hm not sure about the "again"-part (you might be right on that). but one small gotcha i've bumped into repeatedly is how procs swallow the returned value (always nil) unless a return type is explicitly specified.
alexherbo2 has joined #crystal-lang
<raz>
super minor thing tho, i'll admit. i've probably just not had a use-case yet where i would have benefited from the shorthand syntax (and therefore don't understand the upside intuitively)
<raz>
hm yea, that one would look nicer w/o the repetition
<FromGitter>
<naqvis> yeah, and this was that "again" i was referring to previously. Sorry for not being clear in initial post
<FromGitter>
<kingsleyh> @kalinon awesome thanks - regarding entitas - I'll take a look - I've gone an OO approach so far - but ECS approach could work out well
<FromGitter>
<jwoertink> If you're parsing XML, and you have a single Node, how do you get the value of a specific attribute?
<FromGitter>
<jwoertink> 😂 omg... I don't know why I didn't think of calling it right on node
<FromGitter>
<jwoertink> it just felt more intuitive that if I was iterating over attributes, I'd have access to all of it right there, I guess
<FromGitter>
<jwoertink> Thanks
<FromGitter>
<asterite> `puts attr.content` works too
<FromGitter>
<jwoertink> Ah. Ok, so the strange thing with that is, if you do `puts attr.inspect`, you get `#<XML::Attribute:0x10522ce00 name="id" value="test">`
<FromGitter>
<jwoertink> I didn't look to see if maybe `inspect` is overridden, but maybe that should look like `#<XML::Attribute:0x10522ce00 name="id" content="test">` ?
<FromGitter>
<asterite> Good call, I think we should fix that
<FromGitter>
<asterite> I'll send a PR
<FromGitter>
<jwoertink> Ok. I'll open an issue about that.
<FromGitter>
<jwoertink> Thanks!
alexherbo2 has joined #crystal-lang
<FromGitter>
<kalinon> Anyone know an easy way to get the md5/sha1 of a file?
<FromGitter>
<j8r> you may want `Digest::SHA1.hexdigest`
<FromGitter>
<kalinon> ok thats what i figured. perfect, thank you!
<Stephie>
jhass, might want to up the number of workers on aarch64...
<Stephie>
4 seems like underworking this machine, doesn't it have like 64 cores?
alexherbo2 has quit [Ping timeout: 256 seconds]
<FromGitter>
<Uzay-G> is there a way to get a language server like coc working with crystal in vim? I can prob use coc-ruby but im not sure how to set it up so it enables for crystal files
<FromGitter>
<Blacksmoke16> anyone have snap installed that can do me a favor?
<FromGitter>
<Blacksmoke16> trying to figure out how im able to use my snap anywhere, when its defined as `strict` and didnt have any plugs
redplateaus[m] has joined #crystal-lang
<redplateaus[m]>
Hey all - is there a way to have a fallback of some kind for `use_json_discriminator` when an unknown key is encountered?
<FromGitter>
<Blacksmoke16> not that i know of, whats the use case?
<redplateaus[m]>
I'm parsing an incoming JSON object from a third party. It consists of an array of "events", each of which has a "type". `use_json_discriminator` seems perfect to parse these into individual types, but I'd like it to not break if a new event type is added
<FromGitter>
<Blacksmoke16> wouldnt you want it to break?, so you know there is a new type
<redplateaus[m]>
My ideal is that any unrecognized event types fall back to some type I define such as UnknownEventType, so I deal with it however, while the rest of the array still gets parsed out like normal
<FromGitter>
<Blacksmoke16> could just define your own macro with that added functionality
<FromGitter>
<Blacksmoke16> copy what the original is doing, but instead of raising, use your fallback
<redplateaus[m]>
Right on, I'll look into that. Just wanted to make sure it wasn't already baked in somehow. Thanks!