Speaking just for my own preferences, I very much like having sigils to differentiate variables from routines, that is, a $ prefix versus either & or no prefix. However, I generally do *not* like the @ and % prefixes. They seem somewhat contrived so to cover very specific variable types while other very similar types don't have them, eg built-in arrays versus some array-like other container type.

And so in my own coding style I use $ for all arrays and hashes too, so all my variables are $. This is done consistently in both Perl 5 and Perl 6. The only place a @ or % appears is when I have to say @{} or %{}, and even then it is mainly just Perl 5 that requires this, such as in foreach or map. Perl 6 is an improvement over Perl 5 in that it is easier to use $ for arrays and hashes too without making code more verbose as a result.

I would be happy if Perl 6 dropped the @ and % for arrays and hashes, using just $ instead; however, I won't necessarily request this as the semantics of @ and % can be useful (assignment copy by value rather than by reference), and I can choose to not use them if I don't want to (TIMTOADY and all that).

On the other hand, unless this steps on something, I could suggest dropping the @ and % anyway, so we have $array and $hash, and then we could instead use the @ and % sigils as a prefix to indicate in that case that we want them to copy by value. For example:

  my $foo = [23, 434, 6];
  my $bar;
  $bar = $foo; # copy by reference
  @$bar = @$foo; # copy by value

Actually, I think that would be a vast improvement, as we could then use the @ prefix with any collection type as short-hand to say that = is copy by value.

I also don't think the language would feel any less Perlish with this change.

-- Darren Duncan

Reply via email to