[Seaside-dev] Issue with subStrings:

Lukas Renggli renggli at gmail.com
Fri Oct 31 07:11:45 UTC 2008


> I am currently using the method "subStrings:" in Seaside 2.9.
> This seems to be a little problem,
> because the semantics on Squeak and GemStone are different.
> And AFAIK its not available on other platforms (VW) by default.

This method is part of Squeak, not Seaside 2.9.

#subStrings: is part of the ANSI Smalltalk standard. The Squeak
implementation looks like it closely follows the recommendation.

> - Change Squeak or GemStone semantics
>    => Probably not !

Tell VW and GemStone that they are not ANSI compatible and that they
should run the ANSI tests regularly ;-)

> - Define new Seaside specific subStrings: method
> - Rewrite those methods to avoid using subStrings:
> ...

Defining a method seems reasonable, but then #subStrigns: is part of
the ANSI standard. Why can't everybody follow *at least* the ANSI
standard?

Seaside already comes with a collection of methods to simplify string
handling. Currently supported are the following methods:

- #excerpt:(radius:(ellipsis:))
- #trimBoth(:)
- #trimLeft(:)
- #trimRight(:)
- #truncate:(ellipsis:)

I find these methods extremely useful. Especially since they avoid to
have ugly #copyFrom:to: 80ties assembly-like instructions all over the
code. The methods are inspired by the Rails text helpers:

  http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html

Of course there is the potential for conflicts when extending String.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside-dev mailing list