On Sat, 19 Apr 2014 20:51:49 -0400, David Held wrote:
On 4/19/2014 5:35 PM, David Held wrote:
interface Foo { }
class Bar : Foo
{
override string toString() pure const { return "Bar"; }
}
void main()
{
Foo foo = new Bar;
foo.toString();
}
To make things more interesting, con
On Sat, 19 Apr 2014 20:45:50 -0400, Adam D. Ruppe
wrote:
On Sunday, 20 April 2014 at 00:35:30 UTC, David Held wrote:
Since all implementations of an interface must derive from Object
That's not true. They can also come from IUnknown or a C++ interface.
This is also not true. Only interfa
David Held:
class Baz
{
override string toString() pure const
{ return cast(Object)(foo).toString(); }
Foo foo;
}
This really makes the compiler go bonkers:
src\Bug.d(11): Error: pure nested function 'toString' cannot
access mutable data 'foo'
src\Bug.d(11): Error: pure nested fu
On 4/19/2014 5:45 PM, Adam D. Ruppe wrote:
On Sunday, 20 April 2014 at 00:35:30 UTC, David Held wrote:
Since all implementations of an interface must derive from Object
That's not true. They can also come from IUnknown or a C++ interface.
Ok, that's a good reason!
cast(Object)(foo).toS
On 4/19/2014 5:35 PM, David Held wrote:
interface Foo { }
class Bar : Foo
{
override string toString() pure const { return "Bar"; }
}
void main()
{
Foo foo = new Bar;
foo.toString();
}
To make things more interesting, consider the call to toString() from
inside a class (which
On Sunday, 20 April 2014 at 00:35:30 UTC, David Held wrote:
Since all implementations of an interface must derive from
Object
That's not true. They can also come from IUnknown or a C++
interface.
cast(Object)(foo).toString();
(cast(Object)foo).toString() might work
This might return
interface Foo { }
class Bar : Foo
{
override string toString() pure const { return "Bar"; }
}
void main()
{
Foo foo = new Bar;
foo.toString();
}
src\Bug.d(14): Error: no property 'toString' for type 'Bug.Foo'
Since all implementations of an interface must derive from Object, why
c