On Fri, 12 Apr 2002, Jonathan E. Paton wrote:
> Yes, it should be optimised away, but why would you do it in the first place?  If
> you tell it to do something, then why should it shy away from doing what it was
> told?  Optimising things that don't occur in everyday programming is a waste of
> time, you can only do so much.

True, but sometimes you do "useless" things for clarity (to other
humans, not to perl of course). Still I see what you mean, and you're
probably right, considering that perl has to do the compiling/
optimising every time you run the program... Also, if you really care
about differences like this, you probably won't want be using Perl in
the first place, will you? :-)

> The architecture of the compiler/optimiser is important too, Perl 5 allows tied
> variables... so $test = $test might not be as simple as it looks.

Tieing did come to my mind as a possible problem, but only too late;
also I don't know nearly enough about neither that nor perl's guts to
to estimate how much it would cost find out wheter $test is tied or
not, on which a decision about what to do with $test = $test ? $test :
$foo or similar would have to be based obviously.

Of course, even if $test was tied, you could still save yourself one
or two instructions for the assignement proper, but I can see the
benifit rapidly aproaching 0 there whith the cost is going towards
positive infinity ;-)

        Elias

-- 
"There are people who don't like capitalism, and there are people who don't like PCs,
but there's no one who likes the PC who doesn't like Microsoft."
 -- Bill Gates


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to