AS3 - evaluating at runtime - D.eval vs hurlant

邮差的信 提交于 2019-12-10 14:37:23

问题


I need to pass in a string that gets evaluated at runtime. So I can write this:

var foo =  someEvalMethod ( "dataObject.someValue" )

instead of:

if ( argIn == "dataObject.someValue")
   var foo = dataObject.someValue
}

Does anyone have an opinion on the following evaluate libraries, or better ones for AS3? Thanks:

AS3 eval by hurlant:

http://eval.hurlant.com/

D.eval by RIA 1:

http://www.riaone.com/products/deval/


回答1:


As far as I know AS3 eval by hurlant is a "real" compiler. It parses code, generates bytecode and injects it to the Flash Player instance in use (through loadBytes() I guess).

D.eval has the same purpose but it does not generate bytecode, it parses expressions and execute them dynamically through its own API.

I see D.eval as a good candidate for what you are trying to achieve. It's not a full featured compiler, but it has enough APIs that cover many simple operations. Other than that it is a product that has a company behind, which is always a good guaranty.

Cheers!



来源:https://stackoverflow.com/questions/7971856/as3-evaluating-at-runtime-d-eval-vs-hurlant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!