Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: RFC: New style for argument check in subs

by LanX (Canon)
on Sep 05, 2012 at 11:38 UTC ( #991816=note: print w/ replies, xml ) Need Help??


in reply to Re: RFC: New style for argument check in subs
in thread RFC: New style for argument check in subs

* Sub::Signatures,

use Filter::Simple ???

are you serious?

* Method::Signatures

use base 'Devel::Declare::MethodInstaller::Simple' ???

are you serious?

* Params::Validate

nice but ...

- overhead by extra sub call

- parameters are unpacked into %p hash, i.e. you need to type $p{x} to access x adn you'll miss all the benefits of compiletime checks for lexicals like my $x.

So any serious arguments other than clicking thru CPAN?

Cheers Rolf


Comment on Re^2: RFC: New style for argument check in subs
Select or Download Code
Replies are listed 'Best First'.
Re^3: RFC: New style for argument check in subs
by Anonymous Monk on Sep 05, 2012 at 13:13 UTC

    use Filter::Simple ??? are you serious?

    absolutely, makes things much nicer

    use base 'Devel::Declare::MethodInstaller::Simple' ??? are you serious?

    absolutely, its for those who want sugar but not source filters -- schwern says its reliable

    nice but ... - overhead by extra sub call

    HA! are you serous? You can't be serious :)

    - parameters are unpacked into %p hash, i.e. you need to type $p{x} to access x

    this isn't the only usage, there is validate_pos, and even as Attribute::Params::Validate

    and you'll miss all the benefits of compiletime checks for lexicals like my $x.

    What compile-time checks?

    So any serious arguments other than clicking thru CPAN?

    You're looking for arguments about something? About what?

    Hey look, these are compile-time :) fields, Hash::Util::lock_keys, Sub::NamedParams

    If you're referring to so which pattern do you think is better? to me there really isn't much difference between them -- not that your mission makes sense to me

    Even if I'm typing this stuff myself, I'm fine with

    defined $pos1 or die "missing arg"; defined $pos2 or $pos2 = 42;

    but I wouldn't mix that and  my ($name1,$name2) = @arg{qw/name1 name2/};

    I would use a hash or a flatlist

Re^3: RFC: New style for argument check in subs
by chip (Curate) on Sep 10, 2012 at 07:48 UTC
    Method::Signatures -- yes, I am serious. It's good.

    Method::Signatures::Simple -- yes, I am serious again. It's still good.

    The computer can handle working harder. You can't.

        -- Chip Salzenberg, Free-Floating Agent of Chaos

      I don't deny it's good, but I have serious problems with such dependencies.

      If it' so good make it core and I'll use it as soon as Debian supports the perlversion.

      In the meantime I like a good style which works w/o XS dependencies.

      Cheers Rolf

        Long experience has taught me that distribution Perl, including Debian, exists to support the code in the distribution, not to support a Perl developer. I strongly recommend building your own Perl and not avoiding XS. Your choice, of course.

            -- Chip Salzenberg, Free-Floating Agent of Chaos

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-07-08 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (96 votes), past polls