>>>>> "JSD" == Jonathan Scott Duff <[EMAIL PROTECTED]> writes:

  JSD> On Fri, Apr 21, 2006 at 11:06:20AM -0700, Larry Wall wrote:
  >> On Fri, Apr 21, 2006 at 12:45:13PM -0500, Jonathan Scott Duff wrote:
  >> : According to S05,  "a /.../ matches immediately in a value context
  >> : (void, Boolean, string, or numeric)" and since 
  >> : 
  >> :     (state $x) ||= / pattern /;
  >> : 
  >> : is very much the same as 
  >> : 
  >> :     state $x; $x = $x || /pattern/;
  >> : 
  >> : I'd say that's a "boolean context" and thus matches against $_ instead
  >> : of assigning the Regex object to $x.
  >> 
  >> Except the right side of || isn't in boolean context till you evaluate
  >> $x that way, so it probably wants to be written with m//:

  JSD> I almost added a little bit of text to the end of that other message
  JSD> but didn't.  I think it's most appropriate now:

  JSD> I must say that I have trouble distinguishing when using // gives you
  JSD> a Regex object and when it actually does pattern matching, so I intend
  JSD> on always using m// when I want a match, and some form of rx// when I
  JSD> want an object.

having read S05's take on that i agree in general. i will probably
always use rx// the way you had to use qr// in p5. i may drop the m in
// as that is the classic 'match this now'. but i think it is good style
to mark these as to what you mean and not let the DWIM rule for you. but
then i also rarely use $_ in p5 so i would be using ~~ as i use =~ now
and that always means match so the m wouldn't be needed for
clarification. but the way p6 uses $_ in some places is much better than
p5 so that rule may need changing too. oy! the habits to be broken and
relearned!

uri

-- 
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