[Issue 535] writef doesn't work on interfaces

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 6 11:04:43 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=535





------- Comment #2 from smjg at iname.com  2007-12-06 13:04 -------
Surely it's not being a COM _interface_, but being a COM _object_ external to D
that would be a problem, right?

I suppose the question is whether the runtime can determine if it's a D object.
 If so, the TypeInfo for interfaces could define this behaviour:  If the
interface defines a suitable toString, use it.  Otherwise, see at runtime
whether the interface instance is a D object.  If so, convert it to an Object
and use its toString, otherwise throw an exception.

If this runtime checking isn't possible (or isn't worth the implementation
cost), then having a documented requirement that the interface defines a
toString for it to work is a possibility, but it still has its drawbacks....


-- 



More information about the Digitalmars-d-bugs mailing list