[Issue 23999] literal suffixes dont mix well with template instantiations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 21 19:54:47 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23999

--- Comment #9 from Dennis <dkorpel at live.nl> ---
(In reply to Nick Treleaven from comment #8)
> No reasonable person's preference can allow one of these suffixes right next to an identifier, because people read the suffix as part of the identifier.

I agree, but it's not the compiler's job to enforce readable code. This is a
valid statement, though no reasonable person would write this:

```
for ({{}for ({}0;){}}0;){}for (X:{}0;){}cast(e)q{u}w~r"o"w;
```

Yes, there are cases of parser footguns that are prevented by the compiler,
such as a lambda returning a function literal `() => {}`. Such exceptions
should not be the norm though, and this issue's particular case is so minor
that I don't think it's worth the added complexity. Consider how there's also
(minor) second order effects, like how this change could break a D minification
tool.

D-scanner would be the right place to implement such a check:
https://github.com/dlang-community/D-Scanner

--


More information about the Digitalmars-d-bugs mailing list