Discussion:
[perl #57410] [TODO] syntactic sugar for named arguments: "key" => value - Add to PDD19 or deprecate
(too old to reply)
Klaas-Jan Stol
2008-07-30 13:13:49 UTC
Permalink
# 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
Will Coleda
2008-07-30 19:21:38 UTC
Permalink
On Wed, Jul 30, 2008 at 9:13 AM, via RT Klaas-Jan Stol
Post by Klaas-Jan Stol
# 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,
foo( "answer" => 42 )
This syntax is implemented in IMCC.
.param int "key" => answer
was deprecated (but it is implemented IIRC).
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
Klaas-Jan Stol
2008-07-31 09:01:27 UTC
Permalink
On Wed, Jul 30, 2008 at 8:22 PM, Will Coleda via RT <
Post by Will Coleda
On Wed, Jul 30, 2008 at 9:13 AM, via RT Klaas-Jan Stol
Post by Klaas-Jan Stol
# 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,
Post by Klaas-Jan Stol
foo( "answer" => 42 )
This syntax is implemented in IMCC.
.param int "key" => answer
was deprecated (but it is implemented IIRC).
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
Andrew Whitworth
2008-11-30 00:13:55 UTC
Permalink
On Sat, Nov 29, 2008 at 1:54 PM, Klaas-Jan Stol via RT
Post by Klaas-Jan Stol
.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).
I'm in favor of removal, personally. I agree that this syntax doesnt
do anything to help readability.

--Andrew Whitworth

Loading...