Just today I was loading objects from an ODBCRow and wrote a: Collection>>addIfNotNilOrBlank ! Like you said...sometimes you get '', sometimes you get nil! Take care, Rob On Tue, Oct 7, 2008 at 6:02 PM, Keith Hodges <keith_hodges@yahoo.co.uk>wrote:
When I think about this issue in different terms I think it makes more sense. No matter how perfect my code I find myself interfacing to things like MySQL where it is happy to return nil when it means an empty string.
someValue ifNotUsefulUse: [ defaultValue ].
but then the question "what does useful mean", at which point it becomes easier to define clearly what is not useful i.e.
someValue ifNilOrEmpty: [ defaultValue ].
If I had known this call existed I would use it much more because
b := someValue ifEmpty: [ defaultValue ].
doesnt work (see earlier discussions on squeak-dev)
regards
Keith
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project