--- Jarkko Hietaniemi <[EMAIL PROTECTED]> wrote:
> 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 can live with that, provided that it's made clear what's happening.
Which is why I suggested a coding convention for this kind of thing.
Perhaps simply acknowledging that all INT objects will use primarily
their true property instead of their value to handle logical branching.
(As opposed to int objects, which will set no properties...or do I have
that backwards?)
> 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.
My angst is not "more features equals less maintainability". It's
"secret handshakes cause paranoia". I don't object to the new features.
But I want the new features to live in the light of day. I can easily
envision the following conversation:
Geek: It took three days, but I tracked down the bug in my program,
sir. It turns out that there's a feature of perl6 that says that when
this other module sets the <foo> property, it causes <...> and that was
taking precedence over my return(1); statement.
Boss: AWK!
So long as the perl6 culture makes clear what the "suggested" role of
these things is (and Damian's exegesis is a great thing,
clarification-wise) there should be no problem. But the point about
disconnecting properties and values, and action at a distance, is a
valid one.
I guess a good rule would be, "Use return values consistently. If you
have to return data, then use the true property to return status. If
you can't use :true, then use :result."
Thus:
if (databases_are_equal(dba, dbb)) {...} # uses value
my $fh = open(fname) or die "Argh!"; # uses :true
if ($retval = func(@args)) { ... } # uses :true
if (($retval = func(@args):result.type() <
CatastrophicEventThreateningTheContinuedExistenceOfLifeOnThisPlanet) {
... } # uses too many characters :-)
=Austin
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/