|
Fernando,
> Is there any difference between
> m := ''.
> m2 := String new
>
> that I should be aware of?
Yes, although it's not as important as it used to be. '' is compiled as a
literal constant and, as such, Dolphin folds all references to point to the
same object. If one reference to this object is modified then all
references _used to_ reflect the change. In recent Dolphin versions '' has
been made a read only object and attempts to modify it now throw an error.
Try evaluating each of these in a workspace.
s := '' writeStream.
s nextPutAll: 'hello'
s := String new writeStream.
s nextPutAll: 'hello'
You'll probably turn up a few references to this if you search the
archives - it used to be a common mistake.
--
Ian
Use the Reply-To address to contact me.
Mail sent to the From address is ignored.
|