I hear your arguments, and did state that this is just an example of what can be done. I also do not think I have ignored your argument of parameter checking, as I stated early on that there is no excuse for not checking parameters and return codes. I also stated that not always can a value be defaulted--this example just provided a way of showing setting a default value. Poorly chosen or not, this is a simple example to illustrate.

I always enjoy conversing with you on matters, as I enjoy the different point of view. But let us remember, Examine what is being said, not who is saying.... This was just a quick example, and all I have said is that named parameters can have value. If it is your stance that they can have no value, then I respectfully disagree.

There is a product called PowerKeeper that implements a programmatic interface much as you have described-- foo( opt1, opt2, opt3, optn ). Let's just look at the AddSystem API for a moment:

AddSystem System,['][ReservedParameter],[NewSystemName], NetworkAddress,[PrimaryEmail],PlatformName, [ChangeFreq],[ReleaseDuration],[SystemAutoFl], [\"][FunctionalAccount][\"], [FunctionalAcctCredentials],[ChangeTime], [PasswordRule],[PropagateFlag],[PortNumber], [EnablePassword],[AlternateIP],[Description], [DomainFunctionalAccount],[BoksServerOS],[LineDef], [Timeout],[DomainName],[OracleType],[OracleSIDSN], [CheckFl],[ResetFl],[ReleaseChgFl],[NetBIOSName], [MaxReleaseDuration],[PropagateToAliasesFlag], [SecretPassUsedFl],[ParentSystem] [,LDAPServer,ConnectionEncryption, \"SearchBase\",[AccountNameAttributeName], [PasswordAttributeName],PasswordReadability, [LDAPPort],[MultiValuedPasswordFl],[StoreClearTextFl], [StoreCryptFl],[StoreMD5Fl],[StoreSHAFl], [StoreSMD5Fl],[StoreSSHAFl]][']

There are 47 options, and none named. Moreover, all parameters are position dependent. So by your logic, it is easier to remember that the 'CheckFl' belongs in field 26? I think this is the spirit of the PBP when it comes to when to use named parameters.

To exclude possibility is to limit oneself, to blindly accept is to subjugate ones mind, to explore is to learn. --Poet


In reply to Re^6: How should named paramater keys be named? by DeadPoet
in thread How should named paramater keys be named? by davido

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.