2010/5/26 Peter Hugosson-Miller
<oldmanlink@gmail.com>
Thanks, Lucas!
I like nice clear�concise�lists of logical reasons like this :-)
Not that I disagree with Stef in any way at all, but can you think of reasons - other than the historical ones - why #value:value:value: and friends are to be preferred over #valueWithArguments: ?
The fundamental ones are that�value[:value:]*�a) avoid consing up the array to hold the arguments and b) avoid determining the array's size and dereferencing it when evaluating. �The value[:value:]* primitives are as a result usefully more streamlined than the�valueWithArguments: primitive. �That may still be a historical argument but I still find it compelling:
| b n |
b := [:aa :ab| ].
n := 10000000.
{ Time millisecondsToRun: [1 to: n do: [:i| b value: 0 value: 0]].
�� Time millisecondsToRun: [1 to: n do: [:i| b valueWithArguments: {0. 0}]].
�� Time millisecondsToRun: [1 to: n do: [:i| b valueWithArguments: #(0 0)]] }
Squeak 4.1.1beta2: #(1357 2129 1457)
Cog: �#(141 844 568)
(2.66 GHz Intel Core i7)
--�
Cheers,
PeterOn Wed, May 26, 2010 at 1:20 PM, Lukas Renggli
<renggli@gmail.com> wrote:
> not right to me. I wanted to express the feeling that, for me, the one
> of the best things about Smalltalk is its readability in difference to
> C, which is very fast. The �new compiler optimize� both, anyway.
- The "New Compiler" does not yet work.
- The optimized #and:and:and: code never decompiled correctly.
- The exact semantics of #and:and:and: is not clear without knowing
how it is implemented.
- There are subtle semantic differences between "a and: [ b ] and: [ c
] and: [ d ]" and "a and: [ b and: [ c and: [ d ] ] ]" if the
conditions have side-effects.
- The #and:and:and: constructs are very confusing to newbies, I have
seen that numerous times.
- The use of #and:and:and: doesn't shorten code.
- #and:and:and: is not necessary from a language point of view.
- And most important for me: #and:and:and: is incompatible with the
rest of the world.
Lukas
--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project