develooper Front page | perl.perl6.language | Postings from May 2001

Re: Properties and "0 but true".

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
May 18, 2001 07:11
Subject:
Re: Properties and "0 but true".
Message ID:
20010518091047.I13931@chaos.wustl.edu
> The statement I read was "true in any possible way", which implies that
> if $retval had a "true" property, the result of func would be
> irrelevant, since if func gave 0, "any possible way" would see the
> "$retval is true" property and take the "it worked" route.
> 
> Thus, this code:
> 
> my $retval is true;
> 
> if ($retval = func(@args))
> {
>   # it worked...
> }
> else
> {
>   # nope...
>   print $retval.what_went_wrong, "\n";
> }

Yes... if you are using only the "true" property.  But assume func()
can attach either "true" or "false" to its return value (and in the
latter case, also the "what_went_wrong" property to indicate the cause,
$retval.what_went_wrong("Gorkulator borked.").)

> I don't mind the presence of these potentially horribly confusing
> thingys. After all, thanks to this list I'll be on the right side of
> the learning curve. However, I don't think that "Poo, poo." is the
> correct answer to "How about maintainability?" on anybody's multiple
> choice exam.

I understand your worry but if you are concerned about "more features
equals less maintainability" you have obviously chosen the wrong
language, be it Perl 5 or Perl 6.  No, I'm rather serious.  Perl has
been, is, will be, a pragmatic language that borrows with gusto, and
as a result it has a horde of features.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About