• 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: Andrew Farmer <email@hidden>
  • Date: Thu, 2 Mar 2006 18:00:54 -0800

On 02 Mar 06, at 11:28, Thierry Passeron wrote:
Hello there,

Is there an Eval() like function in cocoa that would eval a string and execute it as if it was a code.
like:


id object=NSEval(@"[SomeClass method1:aparameter :anOtherparameter]" );
would be the same as:
id object=[SomeClass method1:aparameter :anOtherparameter];


Is it possible in Objective-C's Cocoa API ?

Not directly.

Cocoa is a superset of C, which is a compiled language; as such there's no direct way to compile and run code at runtime. However, there are ways to construct method calls, so long as that's all you're doing. It's difficult, however; you may want to try explaining what you're after to see if there's some more straightforward way of doing what you're looking for.

Attachment: PGP.sig
Description: This is a digitally signed message part

 _______________________________________________
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

  • Follow-Ups:
    • Re: Eval() ?
      • From: Chris Hanson <email@hidden>
    • Re: Eval() ?
      • From: Brett Powley <email@hidden>
    • Re: Eval() ?
      • From: "Corey O'Connor" <email@hidden>
References: 
 >Eval() ? (From: Thierry Passeron <email@hidden>)

  • Prev by Date: Re: Punching a hole in an NSImage
  • Next by Date: Re: Advice on using NSCell
  • Previous by thread: Eval() ?
  • Next by thread: Re: Eval() ?
  • Index(es):
    • Date
    • Thread