My, our, thems-over-theres.....

2001-08-14 Thread Bryan C . Warnock

Three variable scope declarators, three different behaviors (as recent as 
5.7.2)

(Set One)

$a = 'a';
{
my $a .= 'b', $a .= 'c' if $a .= 'd', $a .= 'e';
}
print $a, "\n"; # adec

$b = 'a';
{
local $b .= 'b', $b .= 'c' if $b .= 'd', $b .= 'e';
}
print $b, "\n";# ade

$c = 'a';
{
my $c = 'f';
our $c .= 'b', $c .= 'c' if $c .= 'd', $c .= 'e';
}
print $c, "\n";# adebc


(Set Two)

$a = 'a';
{
$a .= 'b', $a .= 'c' if my $a .= 'd', $a .= 'e';
}
print $a, "\n";# aebc

$b = 'a';
{
   $b .= 'b', $b .= 'c' if local $b .= 'd', $b .= 'e';
}
print $b, "\n";# a

$c = 'a';
{
my $c = 'f';
$c .= 'b', $c .= 'c' if our $c .= 'd', $c .= 'e';
}
print $c, "\n"; # ade

I'm sure this makes absolute sense under-the-hood, and it is documented 
(sort of) to behave this way, but isn't it a tad too inconsistent, even for 
Perl?  (Particularly 'my' vs 'our'.  'local' makes sense with its current 
behavior, but I'd personally rather it were consistent, too.)

-- 
Bryan C. Warnock
[EMAIL PROTECTED]



Temp properties

2001-08-14 Thread John Siracusa

(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 :)

-John




Will subroutine signatures apply to methods in Perl6

2001-08-14 Thread Garrett Goebel

Any word from on high whether subroutine signatures will apply to methods in
Perl6? There's RFC128 and RFC97... but they both mostly dodge the issue of
methods.

The absense of method signatures for specifying required, optional, and
named parameters... not to mention type-checking for validation and dispatch
are why we've ended up with an assortment of parameter handling modules with
conflicting styles.