amirrajan / rubymotion-applied

RubyMotion documentation provided by the community. Submit a pull request to the docs for a free one year indie subscription.
Apache License 2.0
49 stars 10 forks source link

Bring back `eval()` at runtime #50

Open hboon opened 6 years ago

hboon commented 6 years ago

While Live Reload would be perfect, eval() is at least a nice stopgap. It used to work in earlier versions of RubyMotion (3.x maybe?). Now it only works in the REPL (so presumably, all the support is still there).

In app_delegate.rb:

eval('3+4')
app/app_delegate.rb:28:in `buildWindow': evaluating strings is not supported in RubyMotion (RuntimeError)

REPL:

(main)> eval('3+4')
=> 7

Tested in macOS.

hboon commented 6 years ago

Thinking about this again. I'm not sure it ever worked correctly. But would be nice.