On Wednesday, 17 June 2020 at 11:50:27 UTC, Per Nordlöw wrote:
Should a range-compliant aggregate type realizing a parser be encoded as a struct or class? In dmd `Lexer` and `Parser` are both classes.

In general how should I reason about whether an aggregate type should be encoded as a struct or class?

I would say a struct.

Parser in dmd does even inherit from Lexer.
It seems to be a quirky design.

Especially for multi-threaded parsing you might want to have more control over memory layout than classes usually give you.

Reply via email to