411 REFERENCE · Wikibooks
The Science of Programming/SwayPresentations/Objects/PublicAndPrivateComponents2
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Public and Private Components
We overload assignment so that only variables can appear
on the left hand side of the assignment operator.
function =($a,b)
{
var assign = shadowed(:=);
if (type($a . code) != :VARIABLE)
{
throw(:restrictedAssignment,
"you are only allowed to assign to simple variables");
}
$a assign b;
}
So, anything like:
x . a = 3;
throws an exception.
Since setters can access the variables directly,
they are not affected by this change.
Next
Previous
Top