class extensions

Alexander Panek alexander.panek at brainsware.org
Thu Aug 30 07:03:25 PDT 2007


Chris Nicholson-Sauls wrote:
> I reiterate what I've said about three times now: I watch as D slowly 
> turns into Ruby.  :)
Hehe. They indeed have similarities - maybe not in language theory or 
overall concept, but in innovation. Having (part of) Ruby's 
expressiveness in D would be a very neat thing, as long as it doesn't 
affect other concepts and goals of D.

> (Although I actually like pseudo-members.  ColdC has this as well, but 
> by modifying a type-lib object; $String.foo() callable as "abc".foo() 
> for example.)

That's actually possible already in D (D1, even):

//
import tango.io.Stdout;

void print (char[] s) {
     Stdout(s);
}

void main () {
     "Hello world!".print(); // omitting () is not possible, though
}
//



More information about the Digitalmars-d mailing list