On Monday, 23 January 2012 at 18:08:51 UTC, Walter Bright wrote:
On 1/23/2012 5:08 AM, Iain Buclaw wrote:
Walter, what are your views on emitting the names of aliased types to debug?

I don't really have an opinion on it, except that generally when I'm debugging I'm interested in what a type really is, not the layer over it.

While this is D1 I think it applies to D2 as well. Classes can be substituted for packages the same behavior is still observed. And yes I have code that does this [1].


class A { class Foo {} }

class B { class Foo {} }

alias A.Foo AFoo;
alias B.Foo BFoo;

void bar(AFoo f)
{
       BFoo var;
       bar(var);
}

src/foo.d(12): Error: function foo.bar (Foo) does not match parameter types (Foo) src/foo.d(12): Error: cannot implicitly convert expression (var) of type foo.B.Foo to foo.A.Foo

The first error line is a bit confusing, the second gets it correct. I guess its mostly my fault here, but getting AFoo and BFoo in the first line and then the full print out in the second would be the best for my case at least.

Cheers, Jakob.


[1] https://github.com/Wallbraker/Charged-Miners/blob/master/src/charge/charge.d

Reply via email to