@@ -297,25 +297,24 @@ Method names can be resolved at runtime with the C<.""> operator.
297
297
# OUTPUT: «(Any)»
298
298
299
299
The syntax used to update C < $.notes > changed in this section with respect
300
- to the previous L < #Attributes > section. Instead of:
300
+ to the previous L < #Attributes > section. Instead of an assignment :
301
301
302
302
$vacation.notes = 'Pack hiking gear and sunglasses!';
303
303
304
- we now:
304
+ we now do a method call :
305
305
306
306
$trip.notes("First steps");
307
307
308
308
Overriding the default auto-generated accessor means it is no longer
309
- available to provide a mutable container on return, and the new update
310
- method is called to set the attribute rather than an assignment.
311
- Using a method call is the preferred approach to adding computation
312
- and logic to the update of an attribute. Many modern languages can
313
- update an attribute by overloading assignment with a “setter” method.
314
- While Perl 6 can overload the assignment operator for this purpose
315
- with a
309
+ available to provide a mutable container on return for an assignment.
310
+ A method call is the preferred approach to adding computation and
311
+ logic to the update of an attribute. Many modern languages can update
312
+ an attribute by overloading assignment with a “setter” method. While
313
+ Perl 6 can overload the assignment operator for this purpose with a
316
314
L < C < Proxy > |https://github.com/perl6/roast/blob/master/S12-attributes/mutators.t>
317
315
object, overloading assignment to set attributes with complex logic is
318
- currently discouraged as weaker OO design.
316
+ currently discouraged as
317
+ L < weaker object oriented design|https://6guts.wordpress.com/2016/11/25/perl-6-is-biased-towards-mutators-being-really-simple-thats-a-good-thing/ > .
319
318
320
319
= head2 Class and Instance Methods
321
320
0 commit comments