develooper Front page | perl.perl5.porters | Postings from September 2012

Various questions about named parameters

Thread Next
Father Chrysostomos
September 16, 2012 12:17
Various questions about named parameters
Message ID:
I think these questions need to be asked:

1. Do we really want to prevent custom call checkers from extending prototype syntax?

2. Do we really want named parameters and parsing prototypes to occupy the same syntactic niche?

3. Should a named parameter list *be* the prototype (accessible through prototype(\&sub), though not necessarily affecting parsing)?

4. Do we really want to create lexical variables without an explicit ‘my’?

5. One suggestion about future extension is that we can easily add ‘:rw’ or ‘:alias’ or ‘is rw’ later, so we don’t have to worry about it now.  But do we really want to have a separate minilanguage here, or should it try to follow existing Perl syntax as far as possible?

I have nothing against this feature, as long as it remains an experimental feature until those questions are answered.

Here is another question:

6. Why not leave @_ alone and have goto use the named parameters when called from inside a sub that has them?

I was planning to stop here and leave the proposals to others, but then I started thinking:

sub foo my($foo, $bar, $baz) {

sub foo my($foo, \$bar, $baz) {

(comparable to (my $foo, \my $bar, my $baz) = ($_[0], \$_[1], $_[2]); i.e., an explicit \ implies a \ on the rhs).

And this:

in addition to the obvious:

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