On Tue, Oct 16, 2001 at 08:31:31PM -0700, David Whipp wrote:
> > Is chomp? just a bad example, or is there some utility in asking if a
> > string has already been chomped?
> 
> The query is asking what the string would look like, if it were chomped.

That's a weird use of a query method.  In fact, that sounds like a
normal method call.  Applied to some other situations:

    # "What would @list look like if it were sorted"
    @sorted_list = @list.sort?

    # "What would this filehandle look like if it were open"
    $open_fh = $fh.open?

I expect query methods to be simple yes/no questions that return
true/false.  @list.sort? should return whether or not the @list were
sorted (not that this is particularly useful) and $fh.open? to tell me
if the filehandle is open or not.

I think the function/method distinction is a better seperation between
"what would this thing look like if it were acted on" and "act on this
thing".

    # What would this look like if it were sorted?
    @sorted_list = sort @list;

    # Sort this list
    @list.sort


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
Me? A robot? That's rediculous! For one thing, that doesn't compute at all!

Reply via email to