Liothen has quit [Read error: Connection reset by peer]
kiwiroy has quit [Read error: Connection reset by peer]
pusewic|away_ has quit [Read error: Connection reset by peer]
kevinsjoberg has quit [Read error: Connection reset by peer]
pusewic|away_ has joined #crystal-lang
pusewic|away_ has quit [Ping timeout: 256 seconds]
r0bby has joined #crystal-lang
pusewic|away_ has joined #crystal-lang
kiwiroy has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
Liothen has joined #crystal-lang
taskylizard has quit [Quit: Leaving]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Changing host]
taskylizard has joined #crystal-lang
ur5us has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Changing host]
taskylizard has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard_ has joined #crystal-lang
taskylizard_ has quit [Client Quit]
raz has quit [Ping timeout: 246 seconds]
raz has joined #crystal-lang
raz has quit [Changing host]
raz has joined #crystal-lang
taskylizard has quit [Remote host closed the connection]
taskylizard has joined #crystal-lang
taskylizard has quit [Ping timeout: 264 seconds]
<fifr>
Hi everyone. I have questions: when "include"ing a generic module and the type parameter refers to some type that comes later in the current scope, it fails with an "undefined constant" error: https://carc.in/#/r/c8m2
<jhass[m]>
instance variables are evaluated only at a second pass I think
<jhass[m]>
Not sure on the desirability part though
<fifr>
jhass[m]: oh, yeah, and it's basically the same even with generics: https://carc.in/#/r/c8o3 so it's probably expected (I've just not been aware of)
<fifr>
thx
Liothen has quit [Ping timeout: 260 seconds]
kiwiroy has quit [Ping timeout: 264 seconds]
kevinsjoberg has quit [Ping timeout: 260 seconds]
r0bby_ has joined #crystal-lang
r0bby has quit [Ping timeout: 264 seconds]
pusewic|away_ has quit [Ping timeout: 264 seconds]
r0bby_ is now known as r0bby
kiwiroy has joined #crystal-lang
Liothen has joined #crystal-lang
pusewic|away_ has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
kiwiroy has quit [Ping timeout: 264 seconds]
r0bby has quit [Ping timeout: 264 seconds]
kevinsjoberg has quit [Ping timeout: 250 seconds]
pusewic|away_ has quit [Ping timeout: 264 seconds]
Liothen has quit [Ping timeout: 264 seconds]
kevinsjoberg has joined #crystal-lang
pusewic|away_ has joined #crystal-lang
Liothen has joined #crystal-lang
kiwiroy has joined #crystal-lang
r0bby has joined #crystal-lang
hightower2 has quit [Ping timeout: 246 seconds]
hightower2 has joined #crystal-lang
notzmv has quit [Ping timeout: 240 seconds]
notzmv has joined #crystal-lang
jeremyc has joined #crystal-lang
<jeremyc>
When I have a variable that can potentially be nil, how can I satisfy the compiler that it is not nil? i.e. if var_name ... File.open(var_name) fails on no overload match (Nil.class | String)
<FromGitter>
<Blacksmoke16> ideally make it so that variable isnt nilable
<FromGitter>
<Blacksmoke16> otherwise you can do like
<FromGitter>
<Blacksmoke16> if you absolutely know it won't be nil, but the compiler can't prove that you can do `var_name.not_nil!`
<FromGitter>
<Blacksmoke16> but usually the best option is ask if that var actually needs to be nilable
<jeremyc>
It's a parameter that may be given on the command line, dealt with through OptionParser.
<jeremyc>
I figured default of Nil was the right thing, if the option wasn't used. Maybe not so.
<FromGitter>
<Blacksmoke16> fwiw you prob want `var_name = nil` not `var_name = Nil`
<FromGitter>
<Blacksmoke16> the latter is assigning it a value of `Nil.class` not the value of `nil`
<FromGitter>
<Blacksmoke16> but yea, if it's optional, using nil seems appropriate
ur5us has joined #crystal-lang
<hightower2>
<hightower2>
Hey give me an idea if you can... So I read some binary data from the wire and create an object from it. This part is easy because the data is always in the same order. But then this is followed by an optional list of binary infos, where each element consists of [type, len, data of type <type> and len <len>]... Reading this is also no problem, but I am kind of unclear on where to save this data in the main object...
<hightower2>
I mean, because type is varying, so I can't just have a list or a hash
<FromGitter>
<Blacksmoke16> use some base type possibly with a disriminator?
<FromGitter>
<maxfierke> a custom struct type is probably a good place for this. `JSON::Any` might be useful inspiration (then you can treat it as a sort of a box of data and keep the secrets of how to interpret that data within that type)
sorcus has quit [Ping timeout: 264 seconds]
<hightower2>
hm indeed, struct could work
<hightower2>
ok, thanks for ideas
<hightower2>
as for base type... yeah, having a base class for all could help, although I'm not sure how far to the final solution that'd bring me.. I'll think about it.
sorcus has joined #crystal-lang
peer is now known as rails
<FromGitter>
<jrei:matrix.org> You can put what's optional to a dedicated ivar
<FromGitter>
<jrei:matrix.org> Then, have a case/when with the type and parse the following data accordingly for each case
<FromGitter>
<jrei:matrix.org> That's the essentially the same as descriminator, as @Blacksmoke16 suggested
<jeremyc>
Does the scry lsp server work? Seems a little dated, was trying to make it work with kakoune w/no luck.
<jeremyc>
Dunno if the problem is with Kakoune or scry
<riza>
I think crystaline is more up to date, but i don't think either are nearing completion yet