DMD 0.174 release

Ary Manzana ary at esperanto.org.ar
Wed Nov 15 02:59:39 PST 2006


Walter Bright escribió:
> Stewart Gordon wrote:
>> Good work on the whole.  However, I'm puzzled by a few issues:
>>
>> 1. At first sight it appears to bear little resemblance to my rewrite. 
>> OK, so it implements the distinction between things that introduce a 
>> new scope and things that don't, and on closer examination you've 
>> taken into account some of the other issues I've raised.  But what's 
>> happened to the issue of where a DeclarationStatement or 
>> ScopeGuardStatement (fka ScopeStatement) should be legal?
>>
>> Moving DeclarationStatement and ScopeGuardStatement from 
>> NonEmptyStatement into Statement, NoScopeNonEmptyStatement and 
>> NoScopeStatement would achieve the same as my version in this respect.
> 
> What I did was carefully go through the parse code, and adjust the 
> grammar to exactly match it. So while we can argue about what it should 
> be, at least for the moment it matches what the compiler actually does.

In the DMD code a DeclarationStatement can hold a lot of kinds of 
declarations, not just variables. For example this is valid:

void bla() {
   class X {
   } // DeclarationStatement holding an AggregateDeclaration
}

However in the spec says "Declaration statements declare and initialize 
variables". Should the spec be corrected? The first time I saw it I 
thought there was no possible way to declare a class inside a function. 
This holds true for enums, too.



More information about the Digitalmars-d-announce mailing list