C++ Logo

sg16

Advanced search

Re: Request for discussion on C++ synchronization with WG 14 N3145: $ in Identifiers

From: Corentin Jabot <corentinjabot_at_[hidden]>
Date: Sun, 23 Jul 2023 11:32:25 +0200
I figured I never replied to that.

The reason WG14 is explicitly allowing an implementation to support $ in
identifiers is that they felt that otherwise it would
not be a valid extension for implementers to support them, once added to
the basic character set.
It's less a design decision than a wording matter.

One that, despite my best efforts, I fail to understand, as the set of
basic characters is orthogonal to the grammar of identifiers.
$ is no different than an emoji, neither are allowed in identifiers by the
standard and neither should be allowed in identifiers, and
implementation should warn, if not error, on them regardless of the content
of the basic character set.

Ultimately, I don't think the decision to mention the viability of dollars
in identifiers falls on SG16, but it makes me rather... sad.
Pounctuators are few and precious, and I don't believe in the viability of
non-ascii symbols outside of identifiers and user defined constructs.
Encouraging use of dollars in and as identifiers should at least require a
very hard look at the impact it would have on the evolutivity of the
grammar,
and I'm strongly opposed to such explicit encouragement.

Previous work:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2342r0.pdf

On Thu, Jul 6, 2023 at 9:20 AM Jens Maurer via SG16 <sg16_at_[hidden]>
wrote:

>
>
> On 06/07/2023 00.01, Steve Downey via SG16 wrote:
> > My understanding is that it is now implementation defined if $ is in the
> identifier set, after having been removed entirely.
> > See https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3145.pdf <
> https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3145.pdf>
>
> Ah, that's different, and apparently that was a difference between C and
> C++
> ever since, because C always allowed additional identifier characters and
> C++ didn't.
>
> So, "keeping in sync" actually means "make C++ converge on long-standing
> C rules" for identifier characters.
>
> Jens
>
>
> > On Wed, Jul 5, 2023, 12:28 Hubert Tong via SG16 <sg16_at_[hidden]
> <mailto:sg16_at_[hidden]>> wrote:
> >
> > We adopted, in Varna, a paper that adds $ to the basic character
> set. The week after, the C committee decided (for the C23 DIS) that $ can
> be used within identifiers (including in the initial position).
> >
> > We should consider keeping C and C++ in sync.
> >
> > Note that we already have examples of u"text", etc. where identifier
> non-digits form the initial portion of non-identifier pp-tokens.
> >
> > -- HT
> >
> > --
> > SG16 mailing list
> > SG16_at_[hidden] <mailto:SG16_at_[hidden]>
> > https://lists.isocpp.org/mailman/listinfo.cgi/sg16 <
> https://lists.isocpp.org/mailman/listinfo.cgi/sg16>
> >
> >
> --
> SG16 mailing list
> SG16_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg16
>

Received on 2023-07-23 09:32:39