Re: [Pharo-project] #at:ifAbsent: for Array(s) could be faster
On Nov 2, 2011, at 14:21, Igor Stasenko wrote:
The problem, of course, that trick with #plopp is a dirty hack. Because if array include an #plopp object as element, it will report as it absent, instead of answering it. There is no way to ensure that any arbitrary object are never included as element in array, so this is no-go for generic replacement. But in controlled environment, when you know that none of arrays which you using with #fat:ifAbsent: will ever include #plopp (or pick your own unique object) it may be a good alternative.
If Array class initialize said: NonUserValue := Object new then #plopp can be replaced with NonUserValue and nobody can get at it unless they really intend to (e.g. by making Array be in their classPool). ../Dave
participants (1)
-
Dave Mason