[Seaside-dev] Re: Seaside2.8a1-mb.487

Bany, Michel mbany at cincom.com
Tue Oct 2 08:19:31 UTC 2007


> ... we have been told again and again that we can not use
> #asString as a reliable string conversion method on VW.

The rule is not exactly that. Maybe it is a good time to
reformulate it (was it ever formulated?). How about this:

1. When a string representation of an object is needed
for the UI, send #displayString to this object,
2. When it is needed to convert an object to a string
during some computation, send #asString to the object,
3. All objects understand #displayString,
(all objects are displayable)
4. Not all objects understand #asString
(not all object are convertable).

There is still an unresolved issue with this rule. In VW,
#displayString does not necessarily answer a String :(
as the name would suggest; sometimes we get a Text, sometimes
a Symbol. Therefore, yes, if you erroneously or accidentally
use #displayString as a conversion method, things may not
work as intended.


> Because it is extremely inconsitent. We use #displayString 
> everywhere but there as a conversion method.

I see no extreme inconsistency sending two different messages
for two different purposes.


So where should we go? I can see three different approaches.

1. Be courageous and review the ca. 90 senders of #displayString
in Seaside. See what the intention is. When clearly dealing with
a conversion replace with #asString as I did for the #asFilename:
method. This will apply to converting WAUrl objects to a String.
When dealing with a UI output leave it unchanged. When in doubt
leave it unchanged or ask for someone else's advice. This process
will not break anything in Squeak since #asString and #displayString
produces the same answer in all cases, and since the right messages
will be used for the right intentions, this will improve the
quality of  Seaside. Oh, and I volunteer for doing this huge
change.

2. Forget about the issue and rewrite #testAsFileName

	self assert: (library asFilename: #index) = #index
displayString.

3. Forget even more and move #testAsFileName to WAPlatformSpecificTest

	 



More information about the seaside-dev mailing list