what is a usage pattern for "static" in an interface?

deadalnix deadalnix at gmail.com
Fri Feb 3 03:36:40 PST 2012


Le 03/02/2012 11:40, Paulo Pinto a écrit :
>  From OO design it does not make any sense. I was even't aware that this
> is possible in D.
>
> Static methods are intented to be used as what is commonly known as
> class methods in Smalltalk. Methods
> that are attached to the class class, usually known as metaclass. These
> methods are then transversal to
> all instances of a given class and are called by ClassName.Method() .
>
> Interfaces don't have implementations per se, they only describe a set
> of funcionalities that any implementing
> class is obliged to provide. Hence there is no direct implementation and
> no difference between instances and
> metaclasses.
>
> D interfaces seem then to provide a mechanism where implementing classes
> are forced to implement static methods,
> but since when calling interface methods the form is always
> Interface.Method(), what is the added benefict to force
> static method implementations?
>
> Which use cases have lead to such decision?
>
> --
> Paulo
>

I think this is collateral effet of the qualifier policy of D. For me, 
this doesn't make any sense too, and it is a strong +1 for not allowing 
that.

This is misleading for beginners.


More information about the Digitalmars-d mailing list