Static attributes & immutability, static attributes seen from instances

Simen kjaeraas simen.kjaras at gmail.com
Sat Mar 6 00:06:53 PST 2010


On Sat, 06 Mar 2010 07:33:43 +0100, Nick Sabalausky <a at a.a> wrote:

> The one possible exception I can think of (and I'm not even sure if it's
> applicable to D or not) is if you're passed an instance of something and
> want to call a static member of it polymorphically. Without polymorphism  
> you
> can just do "typeof(instance).staticFunc()", but I'm not sure offhand
> whether or not there's a way to do that polymorphically (or if static
> members can even be polymorphic).

They can't. So the only reason for static members to be available from an
instance is to avoid typeof( T ).

The presence of this feature does not bother me, but I feel the right
thing would be to axe it.

-- 
Simen



More information about the Digitalmars-d mailing list