Reddit: why aren't people using D?

Michel Fortin michel.fortin at michelf.com
Fri Jul 24 20:16:29 PDT 2009


On 2009-07-24 22:58:33 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> This is pretty clean, and in keep with the opXxx approach. Actually how 
> about defining property foo by defining opGet_foo and opSet_foo.

The problem with this is that it's ugly. What about this

	int foo.opGet();        // getter
	void foo.opAssign(int); // setter

with some support from the compiler.

It could even be exteded to support more:

	int foo.opIndex(int); // foo[1];
	void foo.opAddAssign(int); / foo += 1;
	void foo.invert(); // special function attached to property


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list