ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <Blacksmoke16> *soon*
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
taupiqueur has joined #crystal-lang
taupiqueur_ has joined #crystal-lang
ua__ has quit [Ping timeout: 240 seconds]
taupiqueur has quit [Ping timeout: 260 seconds]
ua__ has joined #crystal-lang
<FromGitter> <y8> Ummm. It's not possible to pass undefined constant to macro, so it can be defined in macro body?
taupiqueur has joined #crystal-lang
taupiqueur_ has quit [Ping timeout: 260 seconds]
taupiqueur has quit [Quit: taupiqueur]
<FromGitter> <y8> Ah, okay. It's weirdly failing to catch constant identifiers when some of the macro args are missing.
<FromGitter> <y8> `BUG: trying to downcast Crywa::FloatType (Crystal::NonGenericClassType) <- Crywa::AssemblyType (Crystal::NonGenericClassType) (Exception)` ⏎ ⏎ Aaaaad. I've broken compiler. Lol
jhass[m] has joined #crystal-lang
ejjfunky has quit [Remote host closed the connection]
<jhass[m]> repo: I don't maintain the main arch package, only the crystal-git AUR one ;) I don't think it makes sense to enable anything that the official builds don't either
<FromGitter> <naqvis> > `BUG: trying to downcast Crywa::FloatType (Crystal::NonGenericClassType) <- Crywa::AssemblyType (Crystal::NonGenericClassType) (Exception)` ⏎ > ⏎ > Aaaaand. I've broken compiler. Lol ⏎ ⏎ Though I have no scientific reason to explain why 😃 , but going with `struct` inheritance more than 1 level deep, causes that issue. So in your provided snippet, if you just keep struct inheritance to 1 level
fifr[m] has joined #crystal-lang
xiamx has joined #crystal-lang
<FromGitter> <y8> Having non-abstract structs as union members worked in my case :D Actually it was a my mistake and compiler did a decent job catching it. Error message a bit weird, but thats manageable 😂
<FromGitter> <y8> In that case I want to have Value type. Actually, I would even prefer instances of those structs to be immutable. But sadly there is no `let`'s or `const`s on crystal
<FromGitter> <naqvis> Structs are immutable by default
<FromGitter> <naqvis> and structs are passed by value, so any modification to value type doesn't impact the original object. Unless you are dealing with objects inside your struct
<FromGitter> <y8> They are passed by value, yes, but they are mutable. You can change them in the local scope and you can pass mutated version down the pipe. I would like to have explicit immutability to prevent any changes to instances once initialisation is complete. On that matter, I like the way swift manages mutability.
<FromGitter> <Blacksmoke16> just done define any setters then
<FromGitter> <Blacksmoke16> dont*
<FromGitter> <y8> You still can accidentally mutate state in its own scope. It's "kinda immutable" and won't be caught by compiler. that's the beauty of explicit immutability
<FromGitter> <y8> Also, am I missing somethgin here? https://play.crystal-lang.org/#/r/cpxh
notzmv has quit [Ping timeout: 250 seconds]
<FromGitter> <y8> Why it tries to match against `SecondOne+` instead of `ValidUnion`?
<FromGitter> <y8> Huh. But `action` return type is exactly VaildUnion. Why virtual type here?
<FromGitter> <Blacksmoke16> the union is reduced into `SecondOne+` virtual type
<FromGitter> <Blacksmoke16> is somewhat of a gotcha when it comes to unions like this
<FromGitter> <Blacksmoke16> the docs mention that in that link
notzmv has joined #crystal-lang
<FromGitter> <y8> Hum. So it shouldn't be reduce it to abstract class, right?
<FromGitter> <Blacksmoke16> dont think so? ⏎ ⏎ > The compiler will always do this for classes and structs under the same hierarchy
<FromGitter> <Blacksmoke16> using a module as an interface could work better in this context
xiamx has quit [*.net *.split]
r0bby has quit [*.net *.split]
antoszka has quit [*.net *.split]
pusewic|away__ has quit [*.net *.split]
f1refly has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
<FromGitter> <y8> Uh. It's top level class from`bindata` shard. BinData itself is an abstract class. I have multiple parses inherited from it. And one of them got it's own ancestors. I want to specialize some methods by that one class with it's own ancestors, but crystal squashing it to BinData+ with quazillion other classes :(
xiamx has joined #crystal-lang
pusewic|away__ has joined #crystal-lang
r0bby has joined #crystal-lang
f1refly has joined #crystal-lang
antoszka has joined #crystal-lang
kevinsjoberg has joined #crystal-lang
fifr[m] has quit [Ping timeout: 245 seconds]
jhass[m] has quit [Ping timeout: 240 seconds]
xiamx has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> still, could you use modules for those specialization?
<FromGitter> <Blacksmoke16> maybe not, not real familiar with your code, but thats an idea
<FromGitter> <y8> If I'll mix module to all that classes, I'll be able to specialize by module, not inheritance hierarchy?
<FromGitter> <Blacksmoke16> you'd be able to type something based on the module yea
<FromGitter> <Blacksmoke16> which could play well given abstract methods
ur5us has joined #crystal-lang
jhass[m] has joined #crystal-lang
fifr[m] has joined #crystal-lang
xiamx has joined #crystal-lang
jhass[m] has quit [Read error: Connection reset by peer]
fifr[m] has quit [Read error: Connection reset by peer]
xiamx has quit [Read error: Connection reset by peer]
jhass[m] has joined #crystal-lang
fifr[m] has joined #crystal-lang
xiamx has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]