2015-11-06 16:17 GMT+01:00 Mariano Martinez Peck <[email protected]>:
> Hi guys, > > I have a very large kind of "rule engine" in which rules are written in > smalltalk. These rules are saved as domain objects (imagine a rule kind of > object) which end up having a closure. The code of those closure most of > the time receives an argument and send messages to it. > I want to add automatic method rename for rules. Let's say i have plenty > of rules sending the message (rule) #price and now I want to refactor all > senders to actually send #lastPrice. > > I am taking a look to RBRenameMethodRefactoring and friends. But I wonder > if there is something specifically for managing blocks rather than > methods/classes? > Just write a RBParseTreeRewriter rule with specific elements to only activate inside blocks. Or a cascade: a RBParseTreeSearcher which matches blocks; on each block node you activate a rewriter. However, there is an issue in rewriting blocks contents, because it supposes that the method defining the block is recompiled; it's significantly harder to make changes to the code of live blocks (change the bytescode itself? What if the block has multiples instances?). Thierry > > If not, I think my easiest path is to automatically compile dummy/temporal > classes/methods from the rules, perform the refactor, then move source > from methods to block closures, and finally remove created classes. > > Any pointer is appreciated. > > best, > > -- > Mariano > http://marianopeck.wordpress.com >
