Smalltalk code generation

Alexandre Bergel bergel at iam.unibe.ch
Thu Oct 6 06:28:54 UTC 2005


Hi Mariano!

> cb := self commandBuilder
> m := cb methodNamed: #conditionMethod withFormalArgs: #() comment:  
> 'Condition method'.
> m send: #ifTrue:ifFalse: to: (cb send: #isNil to: cb nil) with: (cb  
> block: [:blk | blk return: (cb literal:'true')])
>                                                                        
>         with: (cb block: [:blk | blk return: (cb literal: 'false')]).

I was wondering in which case do you _really_ need such an approach?

Why not something like to be evaluated in a workspace:

Parser new parse: 'conditionMethod
   "Condition method"
    nil isNil ifTrue:[^true] ifFalse:[^false]' class: nil class

Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.iam.unibe.ch/~bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






More information about the Squeak-dev mailing list