develooper Front page | perl.perl6.language | Postings from August 2001

Temp properties

Thread Next
John Siracusa
August 14, 2001 11:48
Temp properties
Message ID:
(I figured it'd take me longer to track this information down myself than it
would to get a response from the list.  Laziness... :)

Can properties be temp()orarily masked?  For example:

    foreach my $array (@arrays)
      temp $array.sep = ', '; # assuming this is a real property
      print "$array\n";       # prints "item1, item2, item3, ..."

versus an (annoying) explicit save and restore:

    foreach my $array (@arrays)
      my $old_sep =  $array.sep;

      $array.sep = ', ';
      print "$array\n";

      $array.sep = $old_sep;

If it's not possible, I think it should be :)


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About