Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Distinguish between missing and undefined arguments with subroutine signatures

by dave_the_m (Monsignor)
on Dec 27, 2020 at 19:27 UTC ( #11125813=note: print w/replies, xml ) Need Help??


in reply to Re: Distinguish between missing and undefined arguments with subroutine signatures
in thread Distinguish between missing and undefined arguments with subroutine signatures

P5P is considering to drop the population of @_ when signatures are used
But only after alternative facilities for argument instrospection have been provided. See the proposal on the p5p mailing list.

In particular, in

sub foo($x, ??$has_y, $y = 0) { ... }
$has_y is true if and only if a second arg is passed to the sub.

Dave.

  • Comment on Re^2: Distinguish between missing and undefined arguments with subroutine signatures
  • Download Code

Replies are listed 'Best First'.
Re^3: Distinguish between missing and undefined arguments with subroutine signatures
by jo37 (Hermit) on Dec 27, 2020 at 20:31 UTC
    sub foo($x, ??$has_y, $y = 0) { ... }

    Great! That's it. (Or better: Will be)

    Greetings,
    -jo

    $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11125813]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2022-01-18 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (53 votes). Check out past polls.

    Notices?