free method again, treat class as name space only

Lionello Lunesu lio at lunesu.remove.com
Thu Aug 7 06:35:41 PDT 2008


davidl wrote:
> class A
> {
>    void func(){ writefln("hello"); }
> }
> 
> class B
> {
>    void func(){ A.func(cast(A)cast(void*)this); }  // sometimes people 
> need this.
> }
> 
> partial class is good, but it's likely to introduce a lot compiler bugs, 
> and it's likely to increase the compile time.
> 
> multiple inheritance is also nice, also likely to introduce compiler 
> bugs, and multiple inheritance
> make the thing more obscure sometimes, while it needs to be clear.
> 
> the solution I proposed is simple and compact. It can solve all what 
> partial class & MI can solve.
> It won't much bring bad taste in syntax.

What about a static function in a class? Isn't that basically "treating 
class as name space only"?

L.



More information about the Digitalmars-d mailing list