[squeak-dev] Clamato

Robert Krahn robert.krahn at googlemail.com
Sat Sep 5 17:57:19 UTC 2009


Hi, Avi -

I just tried to implement this method without using JavaScript. Here  
is what I have:

- perform: selector with: anObject

	| method evalString |
	@class withAncestors do: [:ea |
		(ea methodAt: selector) ifNotNilDo: [:m | method := m]].
	method ifNil: [self error: 'Method ' , selector , ' not found!'].
	evalString := '(' , method asJavascript , ')(' , anObject , ')'.
	evalString eval.

I expected this to work, however, String>>eval just returns the  
String. The same happens when I try to do '1+1'._eval() in a JS  
console. Do you know where the problem is?

Thanks,
Robert

> Here's an implementation as a primitive:
>
> - perform: aString with: anObject {
>     return this[aString._mangleSelector()](anObject);
> }.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090905/00fbaf95/attachment.htm


More information about the Squeak-dev mailing list