This may go without saying, but ...

If $a === $b means what I think it does, then I believe that a not-premature implementation optimization of === would be that it always $a := $b if it was returning true, so that any future === of $a and $b or aliases thereof could short-circuit with a =:= test even if they weren't created as aliases, and Perl would be automatically more memory efficient without those extra storage copies.


I know that was an implementation issue, but I think that it stands to be explicitly stated anyway, as it is a very simple and effective way to make Perl programs more resource efficient, possibly by orders of magnitude, over not doing so.

(The only time this may not work is if so-called immutable types are tied to external resourses, but then I'm not sure how often this would happen in practice so it could just be an exception if necessary. The above-stated rule would still stand for any resources managed by Perl itself.)

-- Darren Duncan

Reply via email to