Paul "LeoNerd" Evans skribis 2021-11-29 16:08 (+0000): >The final part of the "signatures" feature still to be implemented, is >getting rid of the @_ setup If I understand correctly, accessing @_ is currently commonly used to determine whether an optional argument was passed: sub bar($self, $new = "blah") { $self->{bar} = $new if @_ == 2; $self->{bar}; } ... $x->bar(undef); # set bar to undef Or maybe I'm missing something. Now, one could hack around that with a constant that is near impossible to accidentally pass as the argument... use constant NONE => \do { my $x }; sub bar($self, $new = NONE) { $self->{bar} = $new unless ref($new) and refaddr($new) == refaddr(NONE); $self->{bar}; } That would be ugly, but if that's what it takes to finally get signatures out of experimental status after 8 years, I'd take it. However, it seems to me that there should be a better, and officially supported, way to do this. -- Met vriendelijke groet, // Kind regards, // Korajn salutojn, Juerd Waalboer <juerd@tnx.nl> TNXThread Previous | Thread Next