D needs a type expression syntax
Tim
tim.dlang at t-online.de
Wed May 10 15:26:39 UTC 2023
On Wednesday, 10 May 2023 at 14:12:33 UTC, Quirin Schroll wrote:
> To change meaning silently, `X` would have to be an aggregate
> type that implements `opBinary` as a `static` function. This is
> really important because Nobody Writes Such Code.
>
> I haven’t been able to come up with an example that
> necessitates a `static` operator function.
The parser does not know if X is a type or something else,
because that is only determined later in semantic analysis. So
the parser would need to prefer a type or expression. Semantic
analysis could maybe change the chosen tree later if it is wrong.
But you are right, that it would not change the meaning silently
without static opBinary. If the grammar is changed, then the user
would get an error message.
More information about the Digitalmars-d
mailing list