On 28 August 2011 23:20, commits@source.squeak.org wrote:
Nicolas Cellier uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-nice.613.mcz
==================== Summary ====================
Name: Kernel-nice.613 Author: nice Time: 29 August 2011, 12:20:33.523 am UUID: c5ac2f0a-3419-41d9-a4e5-0331ff55467d Ancestors: Kernel-cmm.612
Don't provide separate setters for Complex #real: and #imaginary: parts. Instead, provide a single #real:imaginary: initializer, that's faster and safer (like Magnitude, Complex numbers might be shared and it would be dangerous to modify a Complex in place).
=============== Diff against Kernel-cmm.612 ===============
If I read my image correctly, this change is the final bit needed to make Complex "purely functional", in the sense that (apart from the inescapable full-state-setter (and crazy things like #instVarAt:put:)) a Complex's state cannot change.
Nice!
frank
2011/8/29 Frank Shearar frank.shearar@gmail.com:
On 28 August 2011 23:20, commits@source.squeak.org wrote:
Nicolas Cellier uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-nice.613.mcz
==================== Summary ====================
Name: Kernel-nice.613 Author: nice Time: 29 August 2011, 12:20:33.523 am UUID: c5ac2f0a-3419-41d9-a4e5-0331ff55467d Ancestors: Kernel-cmm.612
Don't provide separate setters for Complex #real: and #imaginary: parts. Instead, provide a single #real:imaginary: initializer, that's faster and safer (like Magnitude, Complex numbers might be shared and it would be dangerous to modify a Complex in place).
=============== Diff against Kernel-cmm.612 ===============
If I read my image correctly, this change is the final bit needed to make Complex "purely functional", in the sense that (apart from the inescapable full-state-setter (and crazy things like #instVarAt:put:)) a Complex's state cannot change.
Nice!
frank
Well, I only reduced the temptation, but did not eliminate it, one can always call the initializer twice... Newspeak is better protected if I understood.
Nicolas
On 29 August 2011 00:04, Nicolas Cellier nicolas.cellier.aka.nice@gmail.com wrote:
2011/8/29 Frank Shearar frank.shearar@gmail.com:
On 28 August 2011 23:20, commits@source.squeak.org wrote:
Nicolas Cellier uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-nice.613.mcz
==================== Summary ====================
Name: Kernel-nice.613 Author: nice Time: 29 August 2011, 12:20:33.523 am UUID: c5ac2f0a-3419-41d9-a4e5-0331ff55467d Ancestors: Kernel-cmm.612
Don't provide separate setters for Complex #real: and #imaginary: parts. Instead, provide a single #real:imaginary: initializer, that's faster and safer (like Magnitude, Complex numbers might be shared and it would be dangerous to modify a Complex in place).
=============== Diff against Kernel-cmm.612 ===============
If I read my image correctly, this change is the final bit needed to make Complex "purely functional", in the sense that (apart from the inescapable full-state-setter (and crazy things like #instVarAt:put:)) a Complex's state cannot change.
Nice!
frank
Well, I only reduced the temptation, but did not eliminate it, one can always call the initializer twice... Newspeak is better protected if I understood.
Oh, yes: and even if you tried to subtly protect against this, you'd still be doomed to fail. But I reckon the answer to that is "well, if it hurts when you bypass the contract of the object, don't do that."
At least, in the Smalltalk we currently know and love: but there are some interesting projects people are running - Newspeak, Spoon, SecureSqueak, ... - that we can potentially let mature and then harvest :)
frank
Nicolas
squeak-dev@lists.squeakfoundation.org