in reply to A set of new operators. In keeping with the design of Perl?
Just because you write the variable once, this doesn't means that it will be called once in the interpreter. For example:
But note that internally it works like the first! It get the value of $x, multiply by $y, than save the result in $x.$x = $x * $y ; ## With the Syntax Suger: $x *= $y ;
But this are different:
The 1st rewrite all the variable, with the extra of 'xyz'. the 2nd just append 'xyz' to $var.$var = $var . 'xyz' ; $var .= 'xyz' ;
So, how do you think that the interpreter will work with this 2 ways?:
The only good thing in the 2nd is to avoid the rewrite for it self ($latest = $latest ;) of the 1st option. But why not just write:$latest = $latest > time() ? $latest : time(); ## With your Syntax Suger: $latest ?>:= time() ;
Personally I don't like to use much Syntax Sugar, unless the basic (.= += .... $x++). I don't like them for conditional blocks, since I think that this part need to be explicity, since other programers need to know how to read your code (and generally they don't know much about Syntax Sugar). But of course that your idea is valid, since is original. ;-P## Probably what should be made internally: my $tmp = time() ; $latest = $tmp if $latest > $tmp ;
Graciliano M. P.
"The creativity is the expression of the liberty".
|
|---|