stepharo wrote
Hi guys
I was looking at the Collection chapter and I stumbled upon newFrom: and I wonder what is the real difference between newFrom: and withAll:. I have the impression that there is not much difference. There are only 47 senders of newFrom: in the default Pharo image.
Dictionary class>>withAll: interprets its argument as a collection of values, whereas Dictionary class>>newFrom: expects a collection of associations.
I would really deprecate newFrom: in the future.
Stef
Absent a compelling argument for deviating from the ANSI standard, it would be best to adhere to the standard. #withAll: doesn't make sense to treat the argument as supplying the values, as there is nothing to define the keys. <abstractDictionary> suggests the only protocol needed for the argument would be #keysAndValuesDo: (but it /isn't/ specified as such). ANSI specifies #withAll: as having an effect "the same as evaluating Dictionary new addAll: newElements; yourself." #addAll: is shown with "dictionary" for the argument name and typed as <abstractDictionary>. -- View this message in context: http://forum.world.st/newFrom-vs-withAll-tp4876589p4876674.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.