GithubHelp home page GithubHelp logo

ericentin / objc-eval Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 1.0 173 KB

Via gcc and xcode, compile simple objective-c code provided as an NSString at runtime, and execute it within the context of the same, running, program.

Home Page: http://ericentin.com

C 20.10% Objective-C 79.90%

objc-eval's Introduction

objc-eval

objc-eval is ruby-like eval ("eval? what's that?!" read this) for objective-c. Is it a good idea? I don't know. If you have to ask, it's probably not. It will, however, satisfy my (morbid) curiosity about whether or not it's possible. It carries along all the usual security concerns of any language's "eval." Make sure you trust the source of the code that is about to be compiled and executed with whatever privileges the program you used objc-eval in has.

Usage

Add to your project as you would any framework. You can either asynchronously evaluate with a delegate, or synchronously evaluate. Did I mention how stupid this is yet?

Example

OEEvaluation *evaluation = [OEEvaluation evaluationWithCode:@"return @\"Hello World!\";" delegate:nil]; NSLog([evaluation evaluateSynchronously]);

objc-eval's People

Contributors

ericentin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mralexgray

objc-eval's Issues

Possible to reference outside-objects?

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

Make it more robust

Probably have to decide what this means before I can progress any further.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.