Re: Eval() ?
Re: Eval() ?
- Subject: Re: Eval() ?
- From: Philippe Mougin <email@hidden>
- Date: Fri, 3 Mar 2006 13:01:15 +0100
Thierry Passeron wrote:
> Is there an Eval() like function in cocoa that would
> eval a string and execute it as if it was a code.
There is no such functionality in the Cocoa API. However, there are
several open source frameworks that allows you to evaluate other
languages dynamically from within Objective-C and manipulate
objective-C objects from within these languages.
For instance, using F-Script (http://www.fscript.org), your example,
which was:
id object = NSEval(@"[SomeClass method1:aparameter :anOtherparameter]");
would be coded like this:
id object = [[@"[SomeClass method1:aparameter :anOtherparameter]"
asBlock] value];
For more about run-time evaluation and passing objects between
Objective-C and F-Script see this article:
http://www.macdevcenter.com/pub/a/mac/2002/07/12/embed_fscript.html
Best,
Philippe Mougin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden