Array literals' default type

language_fan foo at bar.com.invalid
Mon Oct 12 10:21:19 PDT 2009


Mon, 12 Oct 2009 13:04:03 -0400, Jarrett Billingsley thusly wrote:

> On Mon, Oct 12, 2009 at 10:47 AM, Don <nospam at nospam.com> wrote:
> 
>>> Wasn't the comma operator to be supposed to be important for automatic
>>> code generation?
>>
>> It's used frequently in in the compiler internals. EG, given
>>
>> int foo(X x = default_value) { return 0; } then foo(); becomes:   (X
>> tmp = default_value, foo(tmp));
> 
> There doesn't need to be any *syntactic* reservation for something
> that's used internally by the compiler. I mean, we don't have to
> explicitly mark which brace blocks introduce scopes, but ScopeStatements
> are alive and well inside the compiler. CommaExp could just become
> "SequenceExp" or something and it would have the exact same effect. I
> really don't think there will be a lot of moaning if comma expressions
> disappeared. And yes, for loop increments can be special-cased, geez..

But it breaks the holy C compatibility. When a C veteran with 40+ years 
of C development experience under their belt studies D by porting a 1 
MLOC library to D 2.0, his code will fail as the precious old comma does 
not compute sequencing, but instead will produce a nasty compile error. 
Porting the code in a single go will not be possible anymore and reddit 
commentators will literally crush D.



More information about the Digitalmars-d mailing list