bindatashard. 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 :(
Uh. I don't really get how to work around virtual types. I would love to have annotation to disable virtual typing for specific hierarchies.
My case is: https://play.crystal-lang.org/#/r/cq9m
I'm decoding wasm assembly and it got two formats: text and binary.
Naturally, I want to fully decouple instructions from their encodings, because instructions responsible for code execution. They have different execution specialisations and some of instructions have immediate values.
My idea is to have mapping of opcodes/names to instruction types. And parse instructions with immediate values with
parse_data overloaded with matching signature. This is preferable solution, because their binary assembly have prefixed opcodes so I can further nest parsing with
def parse_data(type : Instruction::Prefixed.class)
What are my options there?
Atomic(Time?)and it says that you
Can only create Atomic with primitive integer types, reference types or nilable reference types, not (Time | Nil). So I says to myself "okay, no problem,
Atomic(Pointer(Time?)). Nope, you can't have an
Pointeris also a
Value. I guess in my case I can use
UInt64timestamps but it seems like there should be some way to box up a
With some kind of parsing generalization: https://play.crystal-lang.org/#/r/cqb2
Doesn't feel right though