September 21, 2014
On 9/21/14, 11:48 AM, bearophile wrote:
> Andrei Alexandrescu:
>
>>> from an objective
>>> point of view, aliases and templates in their current form are
>>> no good candidates to implement strongly typed typedefs. The
>>> semantics are too different.
>>
>> Wise words, thanks! -- Andrei
>
> So are you now admitting that Typedef is fundamentally broken?

No. -- Andrei


September 21, 2014
On 9/21/14, 12:05 PM, Dicebot wrote:
> On Sunday, 21 September 2014 at 18:09:00 UTC, Andrei Alexandrescu
> wrote:
>> On 9/21/14, 8:28 AM, Dicebot wrote:
>>> On Sunday, 21 September 2014 at 15:15:27 UTC, Andrei Alexandrescu wrote:
>>>> alias Int2 = Typedef!(int, "b.Int2");
>>>
>>> ...and don't forget to keep those updated when module / aggregate names
>>> change via refactoring!
>>
>> alias Int2 = Typedef!(int, __MODULE__ ~ ".Int2");
>
> Yeah now let's add __LINE__ there to make sure no clashes happen
> and suddenly we get the same solution as the one proposed but
> with manual typing of all special symbols.

No need. -- Andrei

September 21, 2014
On 9/21/14, 12:05 PM, bearophile wrote:
> Andrei Alexandrescu:
>
>> DRY is DRY. Bloating the language is bloating the language.
>
> To implement a typedef in library code in D perhaps you need a well
> implemented __gensym__ that works correctly in presence of separate
> compilation.

Nice to have, but not necessary. -- Andrei

September 21, 2014
On 9/21/14, 12:11 PM, Dicebot wrote:
> I am just surprised Andrei insists so hard on defending solution
> that is questionable at best.

It's just what the doctor prescribed. A good engineering solution for a minor problem. -- Andrei

September 21, 2014
On 9/21/14, ketmar via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Sun, 21 Sep 2014 08:15:29 -0700
> Andrei Alexandrescu via Digitalmars-d <digitalmars-d@puremagic.com>
> wrote:
>
>> alias Int1 = Typedef!(int, "a.Int1");
>> alias Int2 = Typedef!(int, "b.Int2");
> ah, now that's cool. module system? wut? screw it, we have time-proven manual prefixing!

To be fair we now have __MODULE__. Although it does make the call side a bit ugly. But then again, nothing is stopping anyone from writing a helper template around Typedef that hides all this ugliness, e.g.:

-----
// helper alias
alias StrongAlias(T, string mod = __MODULE__, size_t line = __LINE__)
    = Typedef!(T, T.init, format("%s.%s.%s", mod, line, T.stringof));

// usage:
alias Int1 = StrongAlias!int;
alias Int2 = StrongAlias!int;
static assert(!is(Int1 == Int2));
-----

This works for me locally. We could add __COLUMN__ to be extra-safe of course, by then it should be a solved problem.
September 21, 2014
On Sun, 21 Sep 2014 11:09:28 -0700
Andrei Alexandrescu via Digitalmars-d <digitalmars-d@puremagic.com>
wrote:

> >> alias Int1 = Typedef!(int, "a.Int1");
> >> alias Int2 = Typedef!(int, "b.Int2");
> > ah, now that's cool. module system? wut? screw it, we have time-proven manual prefixing!
> Use __MODULE__. -- Andrei
you still can't grok concept of "ugly == unusable". thank you, i'd better fsck this miserably attempt on type security, and many other practical programmers too. we trying to explain you this and each time you answers "so what? no, it's not." even to people who tried to use this disgusting "solution" and found it unacceptable and broken.

alias Int1 = Typedef!(int, __MODULE__~".Int1");

don't make me laugh. this is not just ugly, this is MEGAUGLY. then we can make some kind of magic template to hide this uglyness, yes. the uglyness which shouldn't be there in the first place. each time when such ugly "workaround" proposed we can see the feature as completely broken.

people trying to tell you that it is broken for single developer (too much to type for nothing). that it is broken for group developement (people will forget to mix all the uglyness for necessary result). that it is just broken.

please, we aren't bunch of kids who just happen to dislike typing extra chars. our objections backed by trying to use the feature in practice.


September 21, 2014
On Sunday, 21 September 2014 at 20:41:22 UTC, ketmar via
Digitalmars-d wrote:
> On Sun, 21 Sep 2014 11:09:28 -0700
> Andrei Alexandrescu via Digitalmars-d <digitalmars-d@puremagic.com>
> wrote:
>
>> >> alias Int1 = Typedef!(int, "a.Int1");
>> >> alias Int2 = Typedef!(int, "b.Int2");
>> > ah, now that's cool. module system? wut? screw it, we have
>> > time-proven manual prefixing!
>> Use __MODULE__. -- Andrei
> you still can't grok concept of "ugly == unusable". thank you, i'd
> better fsck this miserably attempt on type security, and many other
> practical programmers too. we trying to explain you this and each time
> you answers "so what? no, it's not." even to people who tried to use
> this disgusting "solution" and found it unacceptable and broken.
>
> alias Int1 = Typedef!(int, __MODULE__~".Int1");
>
> don't make me laugh. this is not just ugly, this is MEGAUGLY. then we
> can make some kind of magic template to hide this uglyness, yes. the
> uglyness which shouldn't be there in the first place. each time when
> such ugly "workaround" proposed we can see the feature as completely
> broken.
>
> people trying to tell you that it is broken for single developer (too
> much to type for nothing). that it is broken for group developement
> (people will forget to mix all the uglyness for necessary result). that
> it is just broken.
>
> please, we aren't bunch of kids who just happen to dislike typing extra
> chars. our objections backed by trying to use the feature in practice.

Why don't you capitalize?
Looks like you're a reasonable person, and this makes an outsider
think that your IQ is lower than the average. IMO.
September 21, 2014
On Sun, 21 Sep 2014 19:56:48 +0200
Marco Leise via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> It is after all a convenience feature
easy type safety is just "a convient feature"? O_O

i'm wordless.


September 21, 2014
On Sun, 21 Sep 2014 20:48:34 +0000
Tourist via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> Why don't you capitalize?
it's my "one man's crusade" against the thing i see as completely useless.

> Looks like you're a reasonable person, and this makes an outsider think that your IQ is lower than the average. IMO.
and my English is bad too (mea culpa; i have to fix it by taking some courses). but i believe that arguments aren't depend of the speaker. and i don't care what people think about my personality. if they choose to ignore everything i'm writing just 'cause they think that i'm dumb... ah, so be it. it's arguments that counts, not their source.


September 21, 2014
Tourist:

> Why don't you capitalize?
> Looks like you're a reasonable person, and this makes an outsider think that your IQ is lower than the average. IMO.

IQs are a flawed unit of measure. ketmar intelligences seem fine. ketmar reasoning is good here. Why don't you redirect your efforts against someone else more deserving?

Bye,
bearophile