in reply to Re^2: The Accessor Heresy
in thread The Accessor Heresy
That's a requirement that would mean a new feature. Something like:
# Perl: sub set_area_to { my $self = shift; my ($area) = @_; $self->{radius} = sqrt( $area / $PI ); return; } # Ruby def area= (new_area) @radius = Math.sqrt( new_area / @@PI ) end # Note, this means that the Ruby version allows for: # circle.area = 22 # And it will DWIM
I fail to see the problem.
|
|---|