[Dojo-interest] Can anyone explain what dojo's eval method is supposed to do?

David Mark dmark at cinsoft.net
Thu Feb 25 20:50:28 EST 2010


David Mark wrote:
> 
> The one that does not require a return value should clearly use script
> injection as that technique does provide the global scoping that seems to
> be the aim of this method.  The one that does require a return value
> should simply use eval (so as to be consistent).
> 

Or it could use the Function constructor (a better choice), which I believe
is what the branch does, perhaps using a "hidden" (unnamed) argument to
determine whether the caller will be expecting a return value and to remain
compatible with the current single method strategy.   IIRC, there were very
few places in the core that used this function expecting a return value and
those set the "hidden" argument to true.  Due to the fragmented nature of
the core files (which is a bit inexplicable as they are always sewn back
together by the loader in the exact same way), this fix will likely touch
multiple files (a "taboo" that I see some have gotten over since last fall). 
Just reference multiple files with one ticket.  =)

And note that neither one of these techniques works in AIR, so it is assumed
that only builds may be used with that agent (which should be documented).
-- 
View this message in context: http://n3.nabble.com/Can-anyone-explain-what-dojo-s-eval-method-is-supposed-to-do-tp416373p416394.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.


More information about the Dojo-interest mailing list