dst = src rather than src dst

renoX renosky at free.fr
Fri Sep 7 15:39:37 PDT 2007


Carlos Santander a écrit :
> renoX escribió:
>> Vladimir Panteleev a e'crit :
>>> On Thu, 06 Sep 2007 03:56:27 +0300, Bill Baxter
>>> <dnewsgroup at billbaxter.com> wrote:
>>>
>>>> So Vladimir, what reason did you come up with?
>>>
>>> It was discussed in the other part of this thread. It "fits in" with
>>> some other declarations, e.g. variables are declared as <type>
>>> <varname>. Aliases and typedefs are quite similar to that, except
>>> that they're preceded by the respective keyword - "alias"|"typedef"
>>> <type> <newname>.
>>
>> The thing is that C's variable declaration syntax suck, so emulating 
>> it in D is really not a good idea.
>>
>> Look at Limbo the language created by C's inventor, its syntax for 
>> declaring variable is much better:
>> var_name :<type>; // variable initialised with type's default value
>> var_name :<type> = <value>;
>> var_name := <value>; // type inference
>>
>> and regular assignment:
>> var_name = <value>;
>>
>> This is much better than the various syntax inspired by C..
>> To think that Limbo is from 1995, *sigh*..
>>
>> renoX
> 
> That is the same as Pascal, which was invented in 1970.

The order is the same yes but that's about all:
-Pascal didn't have type inference.
-the declarations were in a separated section with the var keyword
-and (not sure) you couldn't do the "var_name :<type> = <value>;" case, 
which can be useful if the type inference do work for a value.

As a bonus, Limbo used short name for its type like C instead of the 
verbose one used by Pascal.

All these 'little details' added makes Limbo's variable declaration much 
nicer than Pascal's one.

renoX



More information about the Digitalmars-d mailing list