Macro Expansion and Smalltalk
Travis has been working on a few ideas to change this sort of code:
<1s> ^self <2s> <3s>' expandMacrosWith: aVariableName with: aBasicAccessingMethod with: sizeof + 1
To something more like this:
<1s>At: anOffset ^self <2s> anOffset * <3p> + <4p>' _1: aVariableName _2: aBasicAccessingMethod _3: aByteSize _4: sizeof + 1
I see what he's trying to do, and you should read his explanation. I do have some nervousness about how it will be used in application code though. This is the sort of thing that's highly useful in tooling, but often quite scay in application code....
Technorati Tags: macro expansion
Comments
Re: Macro Expansion and Smalltalk
[Travis Griggs] September 21, 2011 12:48:47.236
So you'd rather see something like
Dialog warn: ('Remember that <1s> is <2s>''s <3s> (<4p>)'
expandMacrosWithArguments: (Array
with: todayOrTomorrowLabel
with: personName
with: specialDayName
with: date))
instead of
Dialog warn: ('Remember that <1s> is <2s>''s <3s> (<4p>)'
_1: todayOrTomorrowLabel
_2: personName
_3: specialDayName
_4: date)
?
Re: Macro Expansion and Smalltalk
[Travis Griggs] September 21, 2011 12:49:25.386
sigh, that definitely lost something with the formatting being blown away :(
Re: Macro Expansion and Smalltalk
[James Robertson] September 21, 2011 15:06:03.681
Unfortunately, you need to use the escape all brackets...