links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
String method expandMacrosWith:
Last updated at 5:05 pm UTC on 7 March 2017
John Brant
Mon, Mar 6, 2017 at 3:21 PM
Reply-To: The general-purpose Squeak developers list
To: squeak-dev@lists.squeakfoundation.org

On 03/05/2017 02:23 PM, tim Rowledge wrote:

Whilst looking for ways of formatting values of my weather data I discovered the String>expandMacros etc methods, which look rather like they are intended to do something like formatting. But there are no comments, no hints about what is supposed to happen, etc, etc. Couldn’t find anything in the swiki either. None of it appears to be used except in a single unit test.

So what is meant to happen here?

I'm guessing that these methods originally came from the Refactoring Browser port. VisualWorks has expandMacrosmethods which were used by the RB. When the RB was ported, these were created to support the parts of expandMacros that the RB used. I don't know if the VW expandMacros supports more features.

Here are the rules:

Here's an example, that shows all features:

         expandMacrosWith: 1
         with: #() size ~= 1
         with: 'This is a string'
 This is a string'

As a macro expansion goes, it isn't that powerful, but it is fairly simple.

See also
String method format:
STT - Smalltalk Templates