Blocks from strings

Avi Bryant avi at
Thu Jan 1 19:31:56 UTC 2004

On Jan 1, 2004, at 11:04 AM, Nevin Pratt wrote:

> Avi Bryant wrote:
>> <snip>
>> Although I'm very interested in macros and how or why they might be 
>> integrated with Smalltalk, I've lost the thread of how this relates 
>> back to the original posting.  Nevin, can you tell us what you were 
>> actually trying to do by converting strings into blocks, so that I 
>> can try to understand if macros would help?
>> Avi
>  A way to do that would be to create a method somewhat like this:
>   html imageWithSource: aShoppingCartJPEGLink
>            method: #viewcart
> ...and then let the #imageWithSource:method: code either construct a 
> static URL or a block, and then it calls one of the earlier two 
> methods.

This all sounds rather complicated, but anyway - am I correct in 
understanding that you've got code doing something like

    createBlockFor: selector
    ^ self blockFromString: '[self session topView ', selector, ']'

Why isn't that just

    createBlockFor: selector
    ^ [self session topView perform: selector]


More information about the Squeak-dev mailing list