Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl

by LanX (Cardinal)
on Jul 04, 2020 at 10:35 UTC ( #11118903=note: print w/replies, xml ) Need Help??


in reply to Re^3: RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
in thread RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl

Individual defaults are no problem.

set my $var= DEFAULT

does it already.

If there is no prior value, it will be undef because of my .

If you need a dedicated Missing different from undef I could return an error object.

Implementation is no problem, I'd need to think about the best API.

There might also be the case of reused variables - like in a loop - were you skipped the my, but don't want to default to the prior value but undef.

set $var

Again only a question of designing a intuitive API/Syntax and testing use cases.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

) my defaults to undef

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2020-08-14 01:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (75 votes). Check out past polls.

    Notices?