Converting blocks to methods
Randal L. Schwartz
merlyn at stonehenge.com
Sat Jan 19 17:11:23 UTC 2008
>>>>> "Martin" == Martin Beck <martin.beck at hpi.uni-potsdam.de> writes:
Martin> has anyone tried to accomplish something like
Martin> MyNewClass addMethod:#doSomethingWith: with: [ :arg |
Martin> Transcript show: arg].
Martin> MyNewClass new doSomethingWith: 'Hello World'.
Martin> in Squeak? This would mean, to convert a block into a method, thus
Martin> changing the hole semantics. Outer temporaries or other variables are
Martin> of course forbidden. Literals have to be fetched out of the defining
Martin> method and brought into a new compiled method and so on. Or perhaps
Martin> there are other possibilities? Any ideas?
You could invoke the compiler on a decompiled version of the block. Not the
fastest solution, but probably the easiest. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
More information about the Squeak-dev
mailing list
|