On 2012-05-07 23:34, Jonathan M Davis wrote:

You mean the setter?

Yes.

Having a getter property function return by ref does allow you to use a
property exactly as you would a variable, because you're operating on the ref
that's returned. It also makes the property function nigh-on-useless, because
then you're operating on its associated variable outside of the property
function, making it so that you can no longer control access to it. You pretty
much might as well make it a public variable at that point. Not to mention,
even if returning by ref didn't have that problem, it would only work in cases
where the property function was associated with an actual variable (since you
have to return a ref to _something_), so it would still be impossible to
emulate a variable with property functions which calculate the value from
other variables or which grab the value from somewhere else (e.g. a database).

- Jonathan M Davis

Exactly.

--
/Jacob Carlborg

Reply via email to