[Q] Ask on String manipulation

Patrick Logan patrickl at servio.gemstone.com
Tue Apr 28 18:28:00 UTC 1998


    
    glenn wrote:
    >
    > As you suggest, this is used a lot in error handlers and other
    > places, especially in the face of internationalization.
    > 
    > I don't think it's a huge project to create this functionality
    > in Squeak, and while you can't steal the VW code, I think we'd
    > benefit from having compatible syntax, so I'd encourage you or
    > some other Squeaker to check out the VW description.
    
    It's usually used like in 
    [self error:"No object at offset %i!",offset] in Objective C.
    
    Talking about error handling, I've renamed our -ifException: to be
    like Squeak's -ifError: to be compatible.

The neat thing about glenn's example, which does not appear to be in
the ObjC example, above, is the "naming" of the substitution arguments
and the availability of a conditional expression in the pattern
string. Naming allows the same substitution to be mentioned more than
once and out of order in the pattern, and conditionals have their own
utility, as in glenn's example.

(Another source of inspiration may be the Common Lisp "format"
feature, which is even more elaborate. Or perhaps Ken Dickey can post
a blurb about his more modest format feature he developed for
Scheme. 8^)

-- 
Patrick Logan                 mailto:patrickl at gemstone.com
Voice 503-533-3365            Fax   503-629-8556
Gemstone Systems, Inc         http://www.gemstone.com





More information about the Squeak-dev mailing list