There is a typical usage
fileOutSoundLibrary: aDictionary
"File out the given dictionary, which is assumed to contain sound and
instrument objects keyed by their names."
"Note: This method is separated out so that one can file out edited
sound libraries, as well as the system sound library. To make such a
collection, you can inspect AbstractSound sounds and remove the items
you don't want. Then do: 'AbstractSound fileOutSoundLibrary: self'
from the Dictionary inspector."
| fileName refStream |
fileName := UIManager default request: 'Sound library file name?'.
fileName isEmptyOrNil ifTrue: [^ self].
refStream := SmartRefStream fileNamed: fileName, '.sounds'.
refStream nextPut: aDictionary.
refStream close.
which could make sense. Now I saw some other places where this is way
to avoid to be precise.
Stef
On Oct 6, 2008, at 8:28 AM, Stéphane Ducasse wrote:
On Oct 6, 2008, at 3:47 AM, David Pennell wrote:
Stef,
I would expect to see another implementation of ifEmptyOrNil on
UndefinedObject that returns true.
I've seen it used productively for defensive coding in frameworks,
where you may get nil instead of an empty collection passed to you.
Hi david
Good suggestion. I learned something.
UndefinedObject>>isEmptyOrNil
"Answer whether the receiver contains any elements, or is nil.
Useful in numerous situations where one wishes the same reaction to
an empty collection or to nil"
^ true
I still find that somehow ugly. Fixing the cause not the problem.
Stef
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project