Jump to page: 1 2
Thread overview
alias, typedef => typedef, typename
Sep 02, 2002
Walter
Sep 02, 2002
Mark Evans
Sep 03, 2002
Matthew Wilson
Sep 03, 2002
Patrick Down
Sep 03, 2002
Pavel Minayev
Sep 03, 2002
Mac Reiter
Sep 03, 2002
Juarez Rudsatz
Sep 03, 2002
Pavel Minayev
Sep 03, 2002
Mac Reiter
Sep 03, 2002
Pavel Minayev
Sep 04, 2002
Sandor Hojtsy
Sep 04, 2002
Hanhua Feng
Sep 04, 2002
Joe Battelle
Sep 08, 2002
Luigi
Sep 09, 2002
Walter
Sep 09, 2002
Pavel Minayev
Sep 09, 2002
Walter
Sep 09, 2002
Pavel Minayev
Sep 10, 2002
Walter
September 02, 2002
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
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
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
"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
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
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
"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
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
>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
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.

« First   ‹ Prev
1 2