Jump to content

Enforced immutability: Difference between revisions

m
variable trait "is readonly" is not valid anymore
(Add Nimrod)
m (variable trait "is readonly" is not valid anymore)
Line 537:
 
Variables are considered mutable by default, but may be marked as readonly after initialization:
<lang perl6>my $pi is readonly ::= 3 + rand;</lang>
my $pi ::= 3 + rand; # same thing, SSA-ish form</lang>
Unlike variables, formal parameters are considered readonly by default even if bound to a mutable container.
<lang perl6>sub sum (Num $x, Num $y) {
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.