Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
September 05, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
On 9/5/07, Janice Caron <caron@serenityfirefly.com> wrote:
> Please could D allow the following syntaxes
>
> alias dst = src;
> typedef dst = src;
>
> Instead of (or as well as)
>
> alias src dst;
> typedef src dst;
>
> I just prefer the destination on the left. Moreover, it would make for greater consistency throughout D. It would match up with assignment operators, module import renaming, and alias template specializations.
I agree 100%. To me "alias src dst" is confusing, I always forget the order for some reason...
|
September 05, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders Bergh | On Wed, 05 Sep 2007 16:18:43 +0300, Anders Bergh <anders1@gmail.com> wrote: > I agree 100%. To me "alias src dst" is confusing, I always forget the order for some reason... Heh, me too. I wonder why was this syntax chosen. -- Best regards, Vladimir mailto:thecybershadow@gmail.com |
September 05, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | On Wed, 05 Sep 2007 23:22:43 +0300, Vladimir Panteleev <thecybershadow@gmail.com> wrote: > Heh, me too. I wonder why was this syntax chosen. Scratch the last part. -- Best regards, Vladimir mailto:thecybershadow@gmail.com |
September 05, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | Vladimir Panteleev wrote: > On Wed, 05 Sep 2007 23:22:43 +0300, Vladimir Panteleev <thecybershadow@gmail.com> wrote: > >> Heh, me too. I wonder why was this syntax chosen. > > Scratch the last part. > I'm guessing it's because they originally thought of it like a kind of #define macro. --bb |
September 06, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter wrote: > Vladimir Panteleev wrote: >> On Wed, 05 Sep 2007 23:22:43 +0300, Vladimir Panteleev <thecybershadow@gmail.com> wrote: >> >>> Heh, me too. I wonder why was this syntax chosen. >> >> Scratch the last part. >> > > I'm guessing it's because they originally thought of it like a kind of #define macro. Er... except for the fact that that's exactly opposite from how #define works. Nevermind. Where's my rock... So Vladimir, what reason did you come up with? --bb |
September 06, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | On Thu, 06 Sep 2007 03:56:27 +0300, Bill Baxter <dnewsgroup@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>. -- Best regards, Vladimir mailto:thecybershadow@gmail.com |
September 07, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | Vladimir Panteleev a e'crit :
> On Thu, 06 Sep 2007 03:56:27 +0300, Bill Baxter
> <dnewsgroup@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
|
September 07, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
Posted in reply to renoX | renoX escribió: > Vladimir Panteleev a e'crit : >> On Thu, 06 Sep 2007 03:56:27 +0300, Bill Baxter >> <dnewsgroup@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. -- Carlos Santander Bernal |
September 07, 2007 Re: dst = src rather than src dst | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander | Carlos Santander a écrit :
> renoX escribió:
>> Vladimir Panteleev a e'crit :
>>> On Thu, 06 Sep 2007 03:56:27 +0300, Bill Baxter
>>> <dnewsgroup@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
|
Copyright © 1999-2021 by the D Language Foundation