Nathan Wigner, disguised as Perl6 RFC Librarian <[EMAIL PROTECTED]> writes:
[...]
Gut feeling, I don't like this proposal. Examples coming up.
> Increases in namespace are basically always beneficial.
>
> =head2 Potential Problems
>
> This approach is not without its problems. These need to be carefully
> addressed before this can be implemented.
>
> =head3 Iterating through a mixed array
>
[ Examples given, with the suggestion that
for (@mixed_array) { ... }
sets $_ or *_ as appropriate and three different suggestions about
what to do when you have a named variable ]
None of the examples given addresses polymorphism.
for (@stringlike_things) # Strings or objects that stringify
{
print;
}
Under the proposal this becomes
for (@stringlike_things)
{
print defined $_ ? $_ : *_
}
Which is ugly. And which gets more ugly the more one thinks about it.
Consider:
sub mess_with_string ($) {
...
}
for (@stringlike_things) {
mess_with_string($_ || *_);
}
Given that you are also the author of the polymorphism RFC I'd hope to
see this addressed in the next version of this RFC.
> Differentiating scalars and references gives us many key advantages:
>
> 1. Ability to differentiate types in all contexts
But sometimes I don't *want* to differentiate types.
> 2. More compact, readable, and flexible syntax
For flexible values of compact and readable.
> 3. Leftmost $ tells true context
>
> 4. Implicit type checking
But not necessarily *useful* type checking.
> 5. Better cognitive properties
Depends on your definition of 'better'.
> 6. Increased namespace
Hmm... I'm not sure that the Highlander Variable folks would agree
with you. And the thought of this RFC combined with Highlander
variables is just too scary to contemplate.
> [1] The "single" part isn't true, either, since $arrayrefs and $hashrefs
> in fact point to multiple values. Some will counter with the idea that
> $arrayrefs and $hashrefs actually point to "single" arrays and hashes.
> However, this is a stretch in the author's opinion.
Not even vaguely a stretch. One has *a* collection of *some* things.
Such arcane languages as English support this distinction trivially.
> =head1 MIGRATION
>
> The p52p6 translator would have to convert all Perl 5 reference and
> object notations into the new Perl 6 syntax. This is not actually as
> hard as it sounds since a few regexp's would do the trick for
> references. Objects are trickier and would require some backtracking
> through the code.
Hmm... that's one enormous handwave.
--
Piers