[Seaside-dev] Re: Seaside2.8a1-mb.487
Bany, Michel
mbany at cincom.com
Mon Oct 1 11:50:28 UTC 2007
> > I do not see #displayString as a conversion method but rather as a
> > method that produces string representations of objects for the user
> > interface, somehow similar to #printString. Also, using
> #displayString
> > is a little more than a convention. VW does not and cannot have
> > #asString implemented in Object, therefore using something
> else than
> > #asString for getting string representations of objects was an
> > obligation in order to make Seaside portable, rather than a
> > convention. See below the (nearly) complete story as to why Seaside
> > uses #displayString.
>
> So basically neither #displayString nor #asString will ever work.
> Which just means we will have to introduce our own method for
> string conversion that is used by no other Smalltalk (or wait
> for ANSI, *jk*). This doesn't really take me by surprise to
> so I have a concrete
> proposal: #toString. Yes, it's Java-esque but this is good
> thing since it means that we have no conflicts with existing dialects.
Again, #displayString is not intended as a string conversion method,
but as a method for displaying an object to the user interface. When
you need a string conversion method use #asString. When you need a
displayable string for an object use #displayString. Most of the time
the result will be the same, but the intentions are different.
So why no just accept the change I suggested to #asFilename: where
we do not want to display anything to the user interface and where
we clearly need to convert a selector Symbol to a String.
asFilename: aSelector
| dotIndex extension |
dotIndex := self lastUpperCaseIndexIn: aSelector.
dotIndex = 0
ifTrue: [^ aSelector asString].
extension := (aSelector last: aSelector size - dotIndex + 1)
asLowercase.
^ (aSelector first: dotIndex - 1)
, '.' , extension
More information about the seaside-dev
mailing list