[perl #57410] [TODO] syntactic sugar for named arguments: "key" => value - Add to PDD19 or deprecate

Klaas-Jan Stol via RT parrotbug-followup at parrotcode.org
Sat Nov 29 18:54:38 UTC 2008


On Thu Jul 31 02:01:55 2008, kjs wrote:
> On Wed, Jul 30, 2008 at 8:22 PM, Will Coleda via RT <
> parrotbug-followup at parrotcode.org> wrote:
> 
> > On Wed, Jul 30, 2008 at 9:13 AM, via RT Klaas-Jan Stol
> > <parrotbug-followup at parrotcode.org> wrote:
> > > # New Ticket Created by  Klaas-Jan Stol
> > > # Please include the string:  [perl #57410]
> > > # in the subject line of all future correspondence about this 
issue.
> > > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57410 >
> > >
> > >
> > > hi,
> > >
> > > afaics, pdd19 does not specify the syntactic sugar for named 
arguments.
> > So,
> > > the following is not specified:
> > >
> > > foo( "answer" => 42 )
> > >
> > > This syntax is implemented in IMCC.
> > >
> > >
> > > On a side note, the named parameter specification:
> > >
> > > .param int "key" => answer
> > >
> > > was deprecated (but it is implemented IIRC).
> > >
> > >
> > >
> > > This TODO is then as follows:
> > >
> > > Either specify the above argument syntax (e.g. "answer"=>42) in 
pdd19
> > > or remove it from the implementationi.
> > >
> > >
> > > kjs
> > >
> >
> > I just tried to test (.param int "key" => answer) and got an error, 
so
> > I removed it from the PDD (r29880)
> >
> >
> > --
> > Will "Coke" Coleda
> >
> >
> Try this:
> 
> .sub main
>     foo("answer" => 42)
> .end
> 
> .sub foo
>     .param int "answer" => a
>     print a
> .end
> 
> Also, see imcc.y, lines 947-956, this implements this.
> I don't think it's ever used, so we could cheat a bit with the 
deprecation
> cycle.
> 
> kjs


Should we keep the syntax:

.param int "answer" => a

?

I propose to remove it; it's not been documented, and it doesn't add 
particularly to readability IMHO (the argument-side using arrows, OTOH, 
is useful I think, and does add to readability, e.g. foo("answer"=>42).

kjs





More information about the parrot-dev mailing list