Jump to page: 1 2
Thread overview
[Issue 23999] literal suffixes dont mix well with template instantiations
[Issue 23999] Potentially Ambiguous Template Instatiation
Jun 19, 2023
Basile-z
Jun 20, 2023
Basile-z
Jun 20, 2023
Dennis
Jun 21, 2023
Puneet Goel
Jun 21, 2023
Puneet Goel
Jun 21, 2023
Puneet Goel
Jun 21, 2023
Nick Treleaven
Jun 21, 2023
Dlang Bot
Jun 21, 2023
Dennis
Jun 21, 2023
Nick Treleaven
Jun 21, 2023
Dennis
Jun 22, 2023
Puneet Goel
Jun 22, 2023
Puneet Goel
Jun 22, 2023
mhh
June 19, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
Integer literals are affected in the same way :

```
class Foo(alias str) {
  enum STR = str;
}
class Bar {
  Foo!2LUNGS;
}
void main() {
  Bar p;
  pragma(msg, p.tupleof[0].stringof);
}
```

--
June 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86_64                      |All
            Summary|Potentially Ambiguous       |literal suffixes dont mix
                   |Template Instatiation       |well with template
                   |                            |instantiations
                 OS|Linux                       |All

--
June 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dkorpel@live.nl
         Resolution|---                         |INVALID

--- Comment #2 from Dennis <dkorpel@live.nl> ---
There is no ambiguity.

> The source text is split into tokens using the maximal munch algorithm, i.e., the lexical analyzer assumes the longest possible token.

https://dlang.org/spec/lex.html#source_text

The longest possible tokens in your example are `q{foo}` and `q{foo}c` respectively, leaving `bb` and `c` as identifier tokens.

--
June 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

Puneet Goel <puneet@coverify.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #3 from Puneet Goel <puneet@coverify.org> ---
By ambiguity I meant how it would be perceived by an end user.

"Programs are meant to be read by humans and only incidentally for computers to execute."

Donald Knuth

--
June 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

--- Comment #4 from Puneet Goel <puneet@coverify.org> ---
There needs to be a mandatory delimiter (whitespace) between the limiter, which
is a part of the type (template instance) and the object being declared.

--
June 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

--- Comment #5 from Puneet Goel <puneet@coverify.org> ---
s/limiter/literal

--
June 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org
           Severity|critical                    |enhancement

--
June 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ntrel created dlang/dmd pull request #15339 "Fix Issue 23999 - literal suffixes dont mix well with template instan…" fixing this issue:

- Fix Issue 23999 - literal suffixes dont mix well with template instantiations

https://github.com/dlang/dmd/pull/15339

--
June 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #7 from Dennis <dkorpel@live.nl> ---
(In reply to Puneet Goel from comment #4)
> There needs to be a mandatory delimiter (whitespace) between the limiter,
> which is a part of the type (template instance) and the object being
> declared.

This is impossible to express in the lexical grammar, and it isn't the compiler's job to enforce good style, that's something for a linter.

--
June 21, 2023
https://issues.dlang.org/show_bug.cgi?id=23999

--- Comment #8 from Nick Treleaven <nick@geany.org> ---
> This is impossible to express in the lexical grammar

I have changed the pull to a warning rather than an error, like the dangling else warning.

> it isn't the compiler's job to enforce good style

Style is a matter of preference. 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.

--
« First   ‹ Prev
1 2