• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Eval() ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Eval() ?
  • Next by Date: Re: where to put on-resize calculations in NSCell?
  • Previous by thread: Re: Eval() ?
  • Next by thread: Delegate/Method called when key focus of NSTextView
  • Index(es):
    • Date
    • Thread