Implicit concatenation of adjacent string literals

Cecil Ward cecil at cecilward.com
Sun Jun 25 21:47:01 UTC 2023


On Sunday, 25 June 2023 at 21:39:13 UTC, Dave P. wrote:
> On Sunday, 25 June 2023 at 21:30:52 UTC, Cecil Ward wrote:
>> On Sunday, 25 June 2023 at 21:22:49 UTC, Richard (Rikki) 
>> Andrew Cattermole wrote:
>>> This use to work.
>>>
>>> It was removed a few years ago.
>>
>> I think so too. I recently had to rework a lot of old code 
>> because of it, a real nuisance. Was it thought that null 
>> concat was dangerous somehow? A recipe for potential for some 
>> kind of mistakes? I presume that reinstating it would be safe 
>> enough? If there’s any reason to.
>
> It’s easy to make this mistake:
>
> ```d
> const x = [
>      "foo"
>      "bar",
>      "baz"
> ];
> ```
>
> `x` only has 2 elements, when it looks like it has 3.

An excellent point. I now fall in with the new status quo. :-)


More information about the Digitalmars-d mailing list