property syntax strawman

Michel Fortin michel.fortin at michelf.com
Sun Aug 2 12:35:28 PDT 2009


On 2009-08-02 15:07:37 -0400, Michiel Helvensteijn 
<m.helvensteijn.remove at gmail.com> said:

> In my design, they are actual functions with actual names.
> 
> For D this doesn't really work. If you want symbolic placeholders, you may
> want to use something other than 'get' and 'set'. For example, 'in'
> and 'out' have been suggested by some. They are already keywords.

One thing with in and out makes me uneasy. Imagine a setter/getter with 
a contract:

	int prop.out()
	out (result) { assert(result > 3); }
	body { return something; }

	void prop.in(int v)
	in { assert(v > 3); }
	body { something = v; }

Wouldn't it be a little confusing having twice the same keyword so 
close but with a completly different meaning?

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




More information about the Digitalmars-d mailing list