Library Typedefs are fundamentally broken
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Tue Sep 23 10:36:33 PDT 2014
On 9/23/14, 9:56 AM, H. S. Teoh via Digitalmars-d wrote:
> On Tue, Sep 23, 2014 at 04:41:27PM +0000, Dicebot via Digitalmars-d
> wrote:
>> On Tuesday, 23 September 2014 at 16:19:00 UTC, Andrei Alexandrescu
>> wrote:
>>> So why not mix in Typedef? -- Andrei
>>
>> Why would I ever want it? Plain struct is absolutely superior to
>> it.
>
> So what are we arguing about here? If struct + alias this trumps
> Typedef, then we should remove Typedef from Phobos and call it a
> day.
I wouldn't oppose deprecating it. But I think the more fertile direction
is improving it.
> This thread has gone on way too long (and has devolved into
> thinly-veiled name-calling, sarcasm, and nitpicking on definitions
> of words -- only inches away from Godwin's Law) without any action.
Agreed.
> Will anyone object if I submit a PR to get rid of Typedef? :-P
I'd say you'd need good justification that (a) current Typedef has no
advantage over the struct/alias this idiom; (b) there are no significant
ways to improve Typedef in ways that would be difficult to the
struct-based approach (e.g. disallow implicit conversion to base type,
adding constructors etc).
A good start would be to amend the documentation to mention the idiom.
Andrei
More information about the Digitalmars-d
mailing list