Enforced immutability: Difference between revisions
Content added Content deleted
(Add Nimrod) |
m (variable trait "is readonly" is not valid anymore) |
||
Line 537: | Line 537: | ||
Variables are considered mutable by default, but may be marked as readonly after initialization: |
Variables are considered mutable by default, but may be marked as readonly after initialization: |
||
<lang perl6>my $pi |
<lang perl6>my $pi ::= 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. |
Unlike variables, formal parameters are considered readonly by default even if bound to a mutable container. |
||
<lang perl6>sub sum (Num $x, Num $y) { |
<lang perl6>sub sum (Num $x, Num $y) { |