Library Typedefs are fundamentally broken

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 22 11:52:12 PDT 2014


On Mon, 22 Sep 2014 16:21:42 +0000
Wyatt via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> On Saturday, 20 September 2014 at 04:52:58 UTC, Andrei 
> Alexandrescu wrote:
> >
> > alias A = Typedef!float;
> > alias B = Typedef!float;
> >
> > By basic language rules, A and B are identical. Making them 
> > magically distinct would be surprising...
> >
> Hold up.  See, "Making them magically distinct would be 
> surprising" is really the sticking point for me because in my 
> experience it rings false.

it's abusing 'alias' which makes it all a mess. if we look at the code
above as 'idiomatic D code', then A and B should be similar. but if we
looking at the code as 'hacky replacement for real typedef', A and B
should not be similar.

seems that Andrei talking about 'idiomatic D' and we are talking about
'hacky typedef replacement'. that's why we can't settle the issue: we
are both right! ;-)

and that's why we need 'typedef' revived, methinks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140922/436313cf/attachment.sig>


More information about the Digitalmars-d mailing list