in reply to Re: Language features affect style
in thread Language features affect style
Indeed, which is why we've gotten rid of most of Perl 5's (not so) beloved boilerplate in Perl 6. Here's the same code (more or less) in Perl 6:
This may or may not tweak the refactoring knob back toward methods; Perl 6 is still not Java, after all.class Foo { has $!salary; method !private_method ($factor = 2) { $!salary *= $factor } method salary { self!private_method(10); $!salary } } my Foo $foo .= new(:salary(100)); say "salary is ", $foo.salary;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Language features affect style
by John M. Dlugosz (Monsignor) on Jun 09, 2009 at 19:13 UTC | |
by TimToady (Parson) on Jun 09, 2009 at 23:15 UTC | |
by John M. Dlugosz (Monsignor) on Jun 10, 2009 at 17:01 UTC | |
by TimToady (Parson) on Jun 10, 2009 at 19:20 UTC | |
by John M. Dlugosz (Monsignor) on Jun 15, 2009 at 14:21 UTC | |
Re^3: Language features affect style
by Anonymous Monk on Jun 08, 2009 at 15:30 UTC | |
by holli (Abbot) on Jun 10, 2009 at 06:51 UTC |
In Section
Meditations