On Wed, 12 Mar 2014 09:13:08 -0400, Steve Teale
<[email protected]> wrote:
On Wednesday, 12 March 2014 at 11:56:43 UTC, Steven Schveighoffer wrote:
On Wed, 12 Mar 2014 06:57:08 -0400, Steve Teale
<[email protected]> wrote:
What you want simply isn't possible. An interface binds at runtime, and
you need to declare types at compile-time. You can't use an interface
method to define the type of y.
-Steve
Steve
OK, it was a bad illustrative example, but
(cast(typeof(a.myType()) whatever).foo();
could be useful, when foo() is not in the interface.
It was the failure of auto in an interface that I was remarking on -
should at least be documented. Also the covariant return values as
suggested by md don't work either.
Auto doesn't work if you don't define what it returns. Auto is not a type
in itself, it means "infer the type". If there's nothing to infer with,
it's an error.
-Steve