Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: How should named paramater keys be named?

by kejohm (Hermit)
on Jun 28, 2011 at 05:21 UTC ( #911664=note: print w/ replies, xml ) Need Help??


in reply to Re^3: How should named paramater keys be named?
in thread How should named paramater keys be named?

perlmodstyle mentions the use of named parameters with a leading hyphen.


Comment on Re^4: How should named paramater keys be named?
Re^5: How should named paramater keys be named?
by davido (Archbishop) on Jun 28, 2011 at 05:39 UTC

    Great find! It partially supports Damian Conway's Perl Best Practices, except that he advocates for an anonymous hash, like this:

    my $obj = This::Class->new( { that => 2, those => 4 } );

    He makes the point that a missing 'value' with this strategy would result in compile-time error this way rather than a runtime problem.

    Regarding perlmodstyle's mention that the hyphenated parameter tag is based on an antequated need, it does confirm that the behavior of the fat comma is supposed to quote strings with hyphens in them (even at the beginning). So perl and perlmodstyle are both at odds with perlop as to what should qualify for the fat comma's quote-like behavior.


    Dave

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2014-12-22 01:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls