Library Typedefs are fundamentally broken

via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 22 01:27:01 PDT 2014


On Sunday, 21 September 2014 at 23:00:09 UTC, ketmar via 
Digitalmars-d wrote:
> On Sun, 21 Sep 2014 22:07:21 +0000
> Ola Fosheim Grostad via Digitalmars-d 
> <digitalmars-d at puremagic.com>
> wrote:
>
>> I am waiting for a patch...
> i believe that we should revive 'typedef' keyword, but i'm not 
> fully
> convinced yet. so i'll wait a little more. but you guessed it 
> right,
> i'm thinking about another patch. ;-)

Why not introduce a std.typecons.Newtype(T) with the desired 
semantics in addition to Typedef(T)?

Btw, there is an argument to be made _for_ the current Typedef: 
If it generates an unpredictable cookie every time it is used 
(and I would count __LINE__ as one, as it can change easily), 
it's very hard to keep binary compatibility. Maybe taking only 
__MODULE__ in consideration would be a good compromise, because 
it at least avoids accidental cross module hijacking.


More information about the Digitalmars-d mailing list