This shouldn't happen

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Apr 25 13:05:00 PDT 2012


On 4/25/12, bearophile <bearophileHUGS at lycos.com> wrote:
> Mehrdad:
>
>> if D
>> hadn't been so shortsighted and hadn't removed typedef's...
>
> Now there's std.typecons.Typedef

Right, but the error messages will be awful, e.g.:

struct None { }
alias Typedef!None HWND;

void test(HWND a, void* b) { }
void main()
{
    test(null, null);
}

test.d(24): Error: function test.test (Typedef!(None,None()) a, void*
b) is not callable using argument types (typeof(null),typeof(null))

We can't just use Typedef!(void*) or Typedef!(int) because -=/+= will
be allowed, which shouldn't be allowed for handles. const(void*) won't
work either, because you should be allowed to assign one handle to
another and const forbids that.


More information about the Digitalmars-d mailing list