in reply to Re^3: Are lvalue methods (as properties) a good idea?
in thread Are lvalue methods (as properties) a good idea?
I'm at a loss to see how this is preferable to:
Juerd has a node that demonstrated this nicely, but I cannnot find it right now. Compare:
$obj->bar++; $obj->bar =~ s[a][b]g; $obj->len++ while substr( $obj->bar, $obj->start, $obj->len ) =~ m[^\s ++$]; substr( $obj->bar, $obj->start, $obj->len, ''); $obj->len = 0;
with:
$obj->bar( $obj->$bar() + 1 ); my $temp = $obj->bar(); $temp =~ s[a][b]g; $obj->bar( $temp ); my $temp2 = $obj->len; my $temp3 = $obj->bar; $temp2++ while substr( $temp3, $obj->start(), $temp2 ) =~ m[^\s+$]; substr $temp3, $obj->start, $temp2, '' ); $obj->bar( $temp2 ); $obj->len( $temp3 );
Another way of looking at it. Would you prefer doing math like this?
## $a++; $a( $a() + 1 ); # $b *= $c-- $d++; $b( $b() * $c( $c() - 1 ) % $d( $d() + 1 ) );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Are lvalue methods (as properties) a good idea?
by jplindstrom (Monsignor) on Jan 13, 2005 at 13:55 UTC | |
by BrowserUk (Patriarch) on Jan 13, 2005 at 18:13 UTC |