C-Style declarations, are they here to stay?!! Walter?

Hasan Aljudy hasan.aljudy at gmail.com
Fri Mar 31 16:07:03 PST 2006


Walter Bright wrote:
> Sean Kelly wrote:
> 
>> Hasan Aljudy wrote:
>>
>>>
>>> So Walter, I would like to please hear your opinion/decision about 
>>> C-Style declarations; are they here to stay? or will they be 
>>> deprecated at some point?
>>
>>
>> I'm hoping they will be deprecated before 1.0.  While this may mean a 
>> small amount of extra work porting headers, I think it's worthwhile.
> 
> 
> I left them in because they do not cause any ambiguities or trouble with 
> the D declaration syntax. It also significantly reduces the amount of 
> work needed to translate code to D. I don't see a compelling reason to 
> remove them; just don't use them if you don't like them.

I think it kinda does.

in C/C++, the following is valid declarations:

     typedef int foo;
     int(x); //OK, declares x as int
     foo(y); //OK, declares y as foo

in D, we get this:

     alias int bar;
     typedef int foo;
     int(x); // OK, declares x as int
     foo(y); // OK!!
     bar(z); // OK!!

     int main()
     {
         .y = 10; // ok
         .z = 20; // ok

         int(x); // OK, declares x as int
         foo(y); // Error!!
         bar(z); // Error!!

         return 0;
     }


why is foo(y) allowed at the global scope? and why is it disallowed at 
local scope?!!





More information about the Digitalmars-d mailing list