3 ms·
That's correct. No hashes; just string equality on the tag name. Everything gets collapsed to an integer. I'll have to read about why OCaml hashes things. Maybe
by tekknolagi 2y ago
That's correct. No hashes; just string equality on the tag name. Everything gets collapsed to an integer. I'll have to read about why OCaml hashes things. Maybe separate compilation?
Edit: oh, it's unique per compilation and isn't meant to be shared around. The variants are shared with string names in flat scraps (small serialized ASTs)
- Joker_vD 2y agoYes, separate compilation, and since your language, as I understand it, will support receiving and using scraps from wherever, you'll have to deal with it too unless you insist on strictly source-code sharing only. You see, those are eternal (well, perennial) problems with distributed code management and every language/computing platform has to deal with them somehow, so that's why I'm interested in what your approach is, especially so since you aim to "solve the software sharability problem".
- tekknolagi 2y agoFor the (slow) interpreter, it's just a string. For the compiler, we may end up just using a string in the end too, and interning, and then doing identity equality on the pointer. This is especially cheap because we have small/in-pointer/immediate strings.