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

Timon Gehr timon.gehr at gmx.ch
Fri Feb 3 15:23:11 PST 2012

On 02/03/2012 11:40 AM, Paulo Pinto wrote:
>  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
> "Jonathan M Davis" wrote in message
> news:mailman.298.1328254901.25230.digitalmars-d at puremagic.com...
> On Friday, February 03, 2012 08:30:31 dennis luehring wrote:
>> any idea why static could makes sense in an interface? any example?
> The same reason it makes sense in a class. I don't see any difference.
> - Jonathan M Davis

More information about the Digitalmars-d mailing list