On Feb 11, 10:00 pm, Owen Jacobson<angrybald...@gmail.com> wrote:
This proposal also "bakes in" a circular dependency between an
interface (List<T>) and its default implementation (ArrayList<T>), such
that there is no way to compile or load either class without the other.
While such circularity is sometimes hard to avoid (enums with
per-constant bodies, for example, are inherently circular), they're not
recommended style and they can lead to hard-to-debug classloading
problems if you're not careful.
I can't think of a use case for this outside of the collection types,
either, and there are already idioms for those. This feels like a
sublimated complaint about the standard library's choice of naming
conventions (List& ArrayList, rather than IList and List as with .Net
or informal protocols and list() like Python).
Interesting proposal, but I think it contains unfixable flaws.
While I hadn't thought of the circular dependency issue, I think that
the existence of such would depend upon the details of
implementation. If the interface included a direct reference to the
default class I think you'd be right. However suppose the interface
only has a reference to a string containing the name of the default
class. Then you can load and use the interface without loading the
default class. The compiler would know to use the class name for the
default class when the default was invoked in a constructor.
every time you use the new.
exists or not.