Date: Thu, 4 May 2023 13:38:27 +0200
On 04/05/2023 11:47, Timur Doumler via Std-Proposals wrote:
> I don't think we could ever have operator** because ** has a meaning
> in C++ today (multiplication followed by dereference, or double
> dereference). Am I missing something?
>
> Cheers, Timur
>
Yes, "x ** y" currently parses as "x * (*y)". I don't know how that
could be resolved without making spaces more significant in token parsing.
(Personally, I'd be happy to see the introduction of rules regulating
spacing in connection with operators - it would lead to neater, more
consistent code that is easier for mere humans to read. But the
standards committee have their little obsessions about backwards
compatibility of existing code, so I don't think that would be accepted!)
If only C++ allowed Unicode symbols and punctuation as identifier
letters, we could use "x ↑ y" for exponentiation (and annoy programmers
with limited keyboard layouts!).
David
> I don't think we could ever have operator** because ** has a meaning
> in C++ today (multiplication followed by dereference, or double
> dereference). Am I missing something?
>
> Cheers, Timur
>
Yes, "x ** y" currently parses as "x * (*y)". I don't know how that
could be resolved without making spaces more significant in token parsing.
(Personally, I'd be happy to see the introduction of rules regulating
spacing in connection with operators - it would lead to neater, more
consistent code that is easier for mere humans to read. But the
standards committee have their little obsessions about backwards
compatibility of existing code, so I don't think that would be accepted!)
If only C++ allowed Unicode symbols and punctuation as identifier
letters, we could use "x ↑ y" for exponentiation (and annoy programmers
with limited keyboard layouts!).
David
Received on 2023-05-04 11:38:35