We are forking D

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Jan 9 03:57:36 UTC 2024


On 09/01/2024 12:09 PM, Walter Bright wrote:
> On 1/8/2024 8:18 AM, Max Samukha wrote:
>> I don't know why they opted for $$. \ is used for any other escape 
>> sequence in D.
> 
> The trouble is \ is already used and consumed when lexing the string. 
> That is why printf uses %%.

It makes no difference.

You would simply be replacing: 
https://github.com/dlang/dmd/blob/c04ae03765bb1d4da8e6b3d0087d6bc46c5c3789/compiler/src/dmd/lexer.d#L1940

with a check in:

https://github.com/dlang/dmd/blob/c04ae03765bb1d4da8e6b3d0087d6bc46c5c3789/compiler/src/dmd/lexer.d#L1954

Works:

``i"\n"``
``i"\$"``

(with this proposed change)
``i"$$"``

Does not work:

``i"$(\n)``
``i"$(\$)``
``i"$($$)"``

So what behavior are you attributing to this escape, that requires it to 
not be consistent with double quoted strings?


More information about the Digitalmars-d mailing list