Thread overview | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 02, 2002 alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
typedef's being strong in D and mere aliases in C has caused some confusion. Any interest in changing the keywords to: alias => typedef // bonus being it's compatible with C's typedef typedef => typename The downside is existing code must change (not too bad with a global file search/replace). If this change was to be made, sooner is certainly better. -Walter |
September 02, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | I might suggest eliminating the term "typedef" completely because of its C baggage. If D semantics are significantly different, then use new names altogether. (If you do use tyepdef then it should mean exactly what it does in C.) I vote for simply "type" and "typealias". Mark |
September 03, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Like the names "Walter" <walter@digitalmars.com> wrote in message news:al0p32$1jva$2@digitaldaemon.com... > typedef's being strong in D and mere aliases in C has caused some confusion. > Any interest in changing the keywords to: > > alias => typedef // bonus being it's compatible with C's typedef > typedef => typename > > The downside is existing code must change (not too bad with a global file search/replace). If this change was to be made, sooner is certainly better. > > -Walter > > |
September 03, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in news:al0p32$1jva$2@digitaldaemon.com: > typedef's being strong in D and mere aliases in C has caused some confusion. Any interest in changing the keywords to: > > alias => typedef // bonus being it's compatible with C's > typedef typedef => typename > I like the current names. As far as I'm concerned typedef finally does what it should have all along. However if you must change I would keep alias and choose a different name for typedef. |
September 03, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote:
> typedef's being strong in D and mere aliases in C has caused some confusion.
> Any interest in changing the keywords to:
>
> alias => typedef // bonus being it's compatible with C's typedef
> typedef => typename
>
> The downside is existing code must change (not too bad with a global file
> search/replace). If this change was to be made, sooner is certainly better.
I like the old version better (probably because "alias" makes it clear that it is an alias), but it is a cosmetic change actually, so no problem with the new syntax either... but wait, it's more to type! =)
|
September 03, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | My vote goes for ditching typedef if it is a problem. I really like alias, because it is clear and explicit. I also like the new typedef behavior, but I understand that it could confuse C/C++ programmers. Personally typedef sounds like exactly the right word for what it does, but it will cause problems for people having to switch languages... 'type' would work for me. 'typename' sounds a little too much like 'make up a new name for this type', which is more like aliasing... 'maketype' might work, if it didn't look so odd. I don't have a strong preference for particular words to take over 'typedef's job, but I have no particular interest in maintaining C compatibility. Kill typedef and pick any word that sounds right... Just keep alias the way it is. Mac In article <al0p32$1jva$2@digitaldaemon.com>, Walter says... > >typedef's being strong in D and mere aliases in C has caused some confusion. Any interest in changing the keywords to: > > alias => typedef // bonus being it's compatible with C's typedef > typedef => typename > >The downside is existing code must change (not too bad with a global file search/replace). If this change was to be made, sooner is certainly better. > >-Walter > > |
September 03, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in news:al0p32$1jva$2@digitaldaemon.com: > alias => typedef // bonus being it's compatible with C's > typedef typedef => typename 1. I think this confusion must be corrected. 2. If all must be changed, why not use two new keywords not present in C ? "alias" and "type" will not confuse the C/C++ programmer. But all declaration must be reevaluated for a conversion to "alias" or "type" and keeping "typedef" could make the programmers not evaluate correctly what need be done. They will ignore the concepts and adopt all as "typedef". C -> D typedef type alias |
September 03, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | Juarez Rudsatz wrote:
> "alias" and "type" will not confuse the C/C++ programmer.
I also think that "type" would be the best choice. But then,
it just looks somewhat weird to type something like:
type void* HANDLE;
Maybe it's better to adopt Pascal syntax?
type HANDLE = void*;
alias LPINT = int*;
|
September 03, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | >Maybe it's better to adopt Pascal syntax?
>
> type HANDLE = void*;
> alias LPINT = int*;
I like that. Does it cause any parsing problems?
Mac
|
September 03, 2002 Re: alias, typedef => typedef, typename | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mac Reiter | Mac Reiter wrote:
>>Maybe it's better to adopt Pascal syntax?
>>
>> type HANDLE = void*;
>> alias LPINT = int*;
>
>
> I like that. Does it cause any parsing problems?
Don't think so. What we have is a keyword (type/alias),
followed by an identifier, then equality sign, and
then everything until the first semicolon is a type
description.
|
Copyright © 1999-2021 by the D Language Foundation