My favorites | Sign in
Logo
          
New issue | Search
for
| Advanced search | Search tips
Issue 64: Seaside-Squeak-Core String>>#trimBlanks method inhibits porting
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Aug 2008
Type-Portability
Priority-Medium
Version-Seaside2.9


Sign in to add a comment
 
Reported by wembley.instantiations, May 06, 2008
What steps will reproduce the problem?

1. Inspect:  (Character cr asString, '    abc') trimBlanks 

What is the expected output? What do you see instead?

On Squeak and Dolphin, I see 'abc'; on VW and VA Smalltalk I see '
   abc' (a CR, three spaces, and 3 letters).

What version of the product are you using? On what operating system?

Seaside-Core pmm.141
Seaside-Squeak-Core lr.44
Seaside-Test pmm.112 

Running on WinXP

Please provide any additional information below.

Since the #trimBlanks method actually removes all separators, it seems 
badly named at best.

Both VW and VA Smalltalk implement String>>#trimBlanks to remove only 
spaces, not all separators.  Dolphin's #trimBlanks implementation matches 
Seaside-Squeak-Core; I don't know about GST or Gemstone.

VA Smalltalk has a similar method, #trimSeparators, to remove all 
separators; I have not found a similar method in other implementations.

I suggest changing the Seaside-Squeak-Core String>>#trimBlanks method (and 
references to it) to String>>#trimSeparators to more-correctly describe 
its function as well as aiding porting.
Comment 1 by philippe.marschall, May 16, 2008
After discussing with Lukas, we prefer something like:

#toTrimmed

- it would remove only leading and trailing spaces, no cr, no lf, maybe tabs 
(haven't made up my mind yet)
- the Java-esque #to avoids conflicts
Status: Accepted
Labels: -Type-Defect Type-Portability
Comment 2 by wembley.instantiations, May 16, 2008
I am quite happy with a platform-neutral method.  But I am a bit confused.  If the 
intent is to remove only leading and trailing spaces, then the current #trimBlanks 
method is a good name and only its underlying implementation in Seaside needs to 
change.  On the otherhand, if the intent is to actually trim all separators (spaces, 
tabs, cr, lf), which is the current implementation in Seaside, then #toTrimmed is a 
good name.  
Comment 3 by renggli, May 16, 2008
Seaside-Utils-Core comes with several String utilities, including powerful methods and tests for String trimming.
Comment 4 by step...@stack.nl, Aug 29, 2008
The trimBlanks is an extension method to String from *Seaside-Squeak-Core.
It conflicts with existing trimBlanks methods in VW and VA (probably Dolphin too).
Renaming it should solve it.
Comment 5 by step...@stack.nl, Aug 29, 2008
In seaside-utils-core there is trimBoth, which has the correct behaviour.
Renamed WAPlatformTest testTrimBlanks to testTrimBoth,
Added WAPlatformTest testTrimBoth2 with the issue,
replaced trimBlanks by trimBoth in 
  WAMimeType fromString:
  WAQualifiedValue fromString:
  WARequestCookie keyFrom:
  WARequestCookie trimBlanksAndQuotes:
Comment 6 by step...@stack.nl, Aug 29, 2008
testTrimBoth2 is not a good name, renamed to testTrimBothWithCr
Comment 7 by monclair, Aug 29, 2008
We must have been 2 working on the same bug:
My work is in Seaside-Tests-YM.141 and Seaside-Core-YM.188
Comment 8 by paolo.bonzini, Aug 29, 2008
In GST, what I am doing is running a pretty big set of RB rewritings on the Squeak
source code when I import it from Monticello.  I just changed "trimBlanks" to
"trimSeparators", and it works.  Maybe other dialects can do the same?  The master
version of course remains the Squeak version.
Comment 9 by philippe.marschall, Aug 30, 2008
#trimBoth from Seaside-Utils is used now
Status: Fixed
Labels: Version-Seaside2.9
Sign in to add a comment

Hosted by Google Code