Library Typedefs are fundamentally broken

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 10:04:47 PDT 2014


On 9/20/14, 8:51 AM, Dicebot wrote:
> On Saturday, 20 September 2014 at 15:26:37 UTC, Andrei Alexandrescu wrote:
>>> But Typedef is not some generic symbol. It is library type specifically
>>> introduced as `typedef` keyword replacement and advertised as such. I
>>> expect it to work as close to `typedef` as possible being the most
>>> priority. Otherwise it is simply useless.
>>
>> No. -- Andrei
>
> I don't really care what you think.

You should if I'm right :o).

> There is a simple fact - there is
> not a single use case I am going to use existing implementation instead
> of rolling one of my own. Call me a pervert but when standard library
> type can't be used for something it was initially proposed for it does
> smell like a failure.

But it can be used. You are quick to claim "failure" just because you 
can't bring yourself to use a simple idiom. Type the blessed string and 
you're done.

So my understanding is your reasoning goes like this:

alias Dollar = Typedef!double; // fantastic
alias Dollar = Typedef!(double, "Dollar"); // failure

I would agree it's not as convenient as a built-in language feature, but 
it's eminently usable and in fact quite nice because it gives you access 
to a nice moniker that can be used, e.g.

alias Dollar = Typedef!(double, "$"); // yum

In the latter case you go on your own and write a bunch of code because 
you refuse to... type a few characters. I hope you understand why it's 
difficult to carry any compelling point with such arguments.


Andrei



More information about the Digitalmars-d mailing list