Why typedef's shouldn't have been removed :(

Steven Schveighoffer schveiguy at yahoo.com
Mon May 7 05:18:36 PDT 2012


On Sun, 06 May 2012 10:58:52 -0400, Mehrdad <wfunction at hotmail.com> wrote:

> You're missing the problem:
>
> (1) I'm saying function(size_t) and function(uint) are different  
> functions, and people are telling me that's silly, who cares about the  
> type anyway. That's not an 'alternative'.

No, they are the same function.  size_t is aliased to uint.  What *you*  
want size_t to mean is not what it is, it's an alias to the word-sized  
unsigned integer on a platform.  Get used to it, use another type if you  
don't want it to be that.

It's the same in C/C++ BTW.  D's alias === C's typedef, and C's size_t is  
a typedef.

> (2) I'm saying function(void*) and function(HANDLE) are different  
> functions, and people are telling me to use TypeDef. Which is of course  
> an alternative, except that it requires me to modify the source code of  
> my library.

Wait, you have to modify one type definition, right?  Is that really not  
satisfactory?  I don't understand this line of reasoning.

> I would be more inclined to agree with those reasons (1) and (2) were  
> the same reason, but they aren't!
>
> So what that tells me is that people are just giving random reasons for  
> not adding back typedef, without actually thinking about the  
> implications.

I can't say I ever used typedef when it was allowed.  I can see how it can  
be useful in certain situations, but I think the path is available to make  
an equivalent library solution work (it seems several people have said it  
doesn't, why not spend time trying to fix it rather than complaining about  
features that aren't coming back?)

> (I'm pretty sure none of the people who suggested using TypeDef for HWND  
> realized that we'd have to do the same thing for size_t and such.  
> Otherwise, when I'd have asked about that, the response wouldn't have  
> been "who cares".)

I think they didn't realize it because it's completely false ;)  You  
saying it's not false doesn't make it any more true.

-Steve


More information about the Digitalmars-d mailing list