Juerd wrote:
Austin Hastings skribis 2005-03-21 15:55 (-0500):
I'd like to see nothing as just an alias for {}.
if $expr
{
do nothing;
}
Possibly the most clear piece of P6 code ever.
Dangerous, though :)
do nothing if $input =~ /\W/;
system "rm -- $input";
But yes, an alias would be nice. There have been some cases where I wanted to explicitly state "} else { do nothing }" to make clear that it was not a design bug.
However, the very same thing can be done with a simple comment:
} else { # do nothing }
And that is exactly what I do.
But you can't solve
nothing while something();
with a comment. Well, not gracefully. Not without inline comments, at least.
There seems to be some support for just saying:
{} while something();
I would also hope the compiler could optimize away something like:
sub nothing () {};
-- Rod Adams