Closed mickvangelderen closed 4 days ago
The problem is that now to encode getters you need to know about a specific trait to get a specific field, whereas with type-level strings you only need to know about a single generic trait for all fields. The latter also allows being generic over field names, which would allow blanketly delegating all getters to a field.
The problem is that now to encode getters you need to know about a specific trait to get a specific field, whereas with type-level strings you only need to know about a single generic trait for all fields.
With type-level strings you need to know about a single generic trait, but also the name of each field. To me, knowing the names of each trait and method versus knowing the names of each type level string is the same.
The latter also allows being generic over field names, which would allow blanketly delegating all getters to a field.
Maybe it would be good to highlight this in the example, and show why that can be useful?
I stumbled upon this crate and wondered what the point was. The main example does not help me. Particularly, the equivalent dependency-free version can be written with some simple traits:
What am I missing?