On Tue, Oct 09, 2001 at 11:22:02AM +0100, Piers Cawley wrote:
> Does the change from ?: to ??:: mean that we can have '?' as a valid
> character in an identifier? I quite like the ruby/scheme idiom of
> having boolean methods ending in a question mark. eg:
> 
>     sub is_visible? {...}

I was gonna suggest that pre-Apoc 3 but ran into the same trouble with ?:

Hmm, $obj.meth! is a syntax error, but func! isn't.  Damn.

For those of you that don't know, func! is another Ruby idiom that
differentiates between the version of a function that returns it's
results and the one which alters it's arguments in place.  So, for
example:

    # this would act like the perl5 chomp
    my $num_chars = chomp! $string;

    # this would leave $string alone and return the chomped string.
    my $chomped_string = chomp $string;

Perhaps a little more useful:

    # Sort as we know it.
    my @sorted = sort @array;

    # Sort in place.
    sort! @array;


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
The eye opening delightful morning taste of expired cheese bits in sour milk!

Reply via email to