objc-eval icon indicating copy to clipboard operation
objc-eval copied to clipboard

Possible to reference outside-objects?

Open ewindso opened this issue 13 years ago • 1 comments

Hi there -- I know you haven't worked on this in 2 years, but it's exactly what I'm looking for! Is it possible say to reference objects that are outside of scope of the eval'd code, within the NSString? Essentially like Javascript:

var x = 3; eval('x = 4'); alert(x); // 4

ewindso avatar Oct 18 '12 00:10 ewindso

That's not really possible since this is just a huge joke hack (that you probably shouldn't use for anything real). One thing you could do is change the OEEvaluator class so that it takes a parameter of type id, and then change OEEvaluation so you can pass an argument along. Then you could pass a dictionary to the eval'd string and refer to it by whatever you called the parameter in OEEvaluator.

ericentin avatar Oct 18 '12 21:10 ericentin