Stéphane Ducasse wrote
> Now a question, I tried to write a comment for and I was wondering why not
> returning '' instead of nil in string.

Ten years after your question, I stumbled upon a SO answer [1] that seems to
explain this behavior. Apparently `string` returns a string-like object
*that retains tree navigation ability* e.g. sibling, parent, where `text`
returns a bare string. From this perspective, `nil` seems appropriate to
indicate that such a navigable object was not available. That said, it
certainly can make the library harder to deal with. What about a Null Object
Pattern that returns an object polymorphic with SoupString and that
implements appropriate no-ops?

1. https://stackoverflow.com/a/25328374



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html

Reply via email to