Hello All,
Has anyone considered a syntax for allowing subroutines to have many
different names for the same argument? For example, in CGI.pm, many
methods support the "-override" parameter but can also accept the alias
of "-force":
$cgi->hidden(-name => "a", -override => 1); #same as
$cgi->hidden(-name => "a", -force => 1);
As far as I can guess, we could use the binding operator to make it work
something like this**:
sub hidden (str $name; int $force, int $override:=$force) { ... }
or maybe even
sub hidden (str $name; int $override:=int $force) { ... }
I have doubts about that last one, since I suspect that people will want
to know what
$force = "dp/dt";
sub work ($distance, $push:=$force) { ... }
is supposed to do, but these are only suggestions. Anyone else want to
shed light on the matter?
Thanks,
Peter Behroozi
**Of course, the real CGI::hidden() also has the "-default" named
argument, but I left that out for clarity.