4 ms·
Don't forget that "type derived code" also happens with any language that has implicit arguments, e.g. type classes in Haskell and implicits in Scala. For examp
by grumpyprole 4y ago
Don't forget that "type derived code" also happens with any language that has implicit arguments, e.g. type classes in Haskell and implicits in Scala. For example, in Haskell, if I compare two lists-of-maps-of-tuples for equality, there are many nested equality functions involved, but the type class machinery generates this code, at compile time for me. In a language without this, e.g. OCaml, many generic operations like equality, to_string, serialisation, etc become very painful.
- still_grokking 4y agoEven "implicits" (especially the explicit ones called `given`s in Scala) are extremely useful I don't think you need them for type-class derivation. Rust does not use "implicits" for that, I think.
- valenterry 4y agoHow does Rust do it? Is it possible to derive using custom logic?
- still_grokking 4y agoIf I would need to guess I would say it's done through Rust's macros. But I would need to look this up also myself. I'm not 100% sure. (But I've never heard of any implicits implemented in Rust; they discussed this feature here and there, but it's not part of anything in the language or the compiler, afik). OT: I've never seen you on the Heise forums ever since. But I guess there isn't much to miss anyway by now…
- valenterry 4y agoHahaha, which name do you go by in Heise forums? I wonder if I remember you too.
- still_grokking 4y agoI prefer not to link accounts, but we've talked not only once. :-) I've recognized your handle as I remember you as being one of the few people there who actually know what they're talking about when it comes to software engineering. But I've also moved on. The overall level has dropped to a bottomless pit by now. It's no fun anymore.
- valenterry 4y ago> I prefer not to link accounts, but we've talked not only once. :-) Fair enough and thank you for the kind words. :)
- still_grokking 4y agohttps://doc.rust-lang.org/reference/procedural-macros.html#derive-macros https://doc.rust-lang.org/reference/procedural-macros.html#d...