Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It's be keen to see two more things supported.

    First, it'd be nice to say, "Yes, I just want named arguments, but they're all in $_[1] as a hashref. The rest is empty."

      $obj->method({ named => 'arguments' });

    Secondly, "Yeah, I have positional and named arguments, with all the named arguments in a hashref at the end."

      $obj->method($arg1, $arg2, { named => 'args' });

    This would cover nearly all my code's methods.

    (Maybe I should STFU and WSFC.)

    • To the hash ref, I don't deny it's common, but I ask why do we do that? One reason is to try and save a copy, if the hash happens to be huge. But they aren't, and if they are do you really want to enumerate all the names? And anyway, breaking the hash ref down into a bunch of scalars wastes all that memory savings anyway.

      Another reason is to leave open the possibility of passing in more arguments.

      $obj->method({ this => 'that' }, 42);

      in which case you're not really passing in named arguments else

      • Apart from anything else, the biggest argument is:

        If I don't have to change the calling semantics, I can actually use this in old code. If I have to update every caller to pass a list rather than a hashref, I am not going to do it. If I can't update my old codebase to use this, I am not likely to start using it for new code, either.