>>>>> "DR" == Dave Rolsky <[EMAIL PROTECTED]> writes:

  DR> Mandatory vs. Optional Parameters

  DR> This is a pretty straightforward one in P6, I think.  Parameters can
  DR> be marked as required with "is required" like this:

  DR>   sub date ($year, ?$month, ?$day) # positional

  DR>   sub date (+$year is required, +$month, +$day) #named

  DR> This is ok but frankly I'm not too keen on the fact that for
  DR> positional subs, the default is required, but for named params it's
  DR> the other way around.

  DR> Wouldn't it clearer to just use a leading "?+" for optional named params?

there are usually more optional params than required ones when doing
named params. so that makes sense to make the default optional. with
positional params usually more of them are required (on the left) and
some optional ones can be on the right. so marking those optional ones
makes more sense. this is all huffman stuff IMO.


Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to