Library Typedefs are fundamentally broken

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


On 9/20/14, 9:32 AM, ketmar via Digitalmars-d wrote:
> On Sat, 20 Sep 2014 08:25:17 -0700
> Andrei Alexandrescu via Digitalmars-d <digitalmars-d at puremagic.com>
> wrote:
>
>> I think this is an entirely palatable idiom:
>> alias ALfloat = std.typecons.Typedef!(float, "ALfloat");
> this is ugly.

But not unusable.

> even if we remove "std.typecons." it's still ugly. making
> such core feature ugly is the right way to marginalize it. "what? all
> this uglyness only for simple typedef? screw it, i'll go with simple
> `alias ALfloat = float;`! oh, wait... this gives me nothing and i
> already messed some declarations... ah, screw it, will use `float`
> then!"

Are you saying you're giving up on an entire design because you can't 
bring yourself to type one string?

> the whole thing with aliasing Typedef is broken.

s/broken/less convenient than a builtin/ and we agree.

> yes, it's smart to use
> library for this (see, our language is THAT powerful!), but it's uuugly.

uuugly != broken

> the same thing as with octal literals: we have 0b, we have 0x, yet it's
> very smart to banish octals to phobos and use octal!"660" instead of
> logical 0o660. phew.
>
> but i know: octal literals are handy, so they will never make their way
> to mainline. "typedef" construct is handy, so...

Not sure I understand this last point. At any rate, if your entire line 
of reasoning hinges on you being unwilling to type a few more characters 
to have a workable solution, I have difficulty taking it seriously.


Andrei



More information about the Digitalmars-d mailing list