ufcs and integer params
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jul 15 12:41:59 PDT 2012
On Sunday, July 15, 2012 11:56:57 Jonathan M Davis wrote:
> > What is enforced here? Why would it matter if anything is 'enforced'?
>
> If you marked it as a property, then it's supposed to be abstracting a
> variable and should be treated as one, just like if it's a normal function,
> it should be invoked as a function, just like ++ shouldn't suddenly do --,
> and / shouldn't *.
And on a purely objective note, if you don't have property enforcement, you
can't turn a property function into a variable, because even though it's
supposed to be used as one, you can't guarantee that everyone's using it that
way, and if they're using it as a function, changing the property into a
variable will break their code. And part of the point of properties is to be
able to switch between variables and property functions depending on whether
additional protections or calculations or whatnot are required for that
variable/property. Property enforcement is required in order to allow that.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list