In the real world, your solution doesn't work.

Like I said, you get a few hundred students of varying skills creating 
templates.  Many will just cut&paste from existing templates, etc.

"use strict" works on the compiled template.

Throwing a run time error or showing the end user the compiled script with 
reference to it for line number where errors occurred is not acceptable.

If you are running in a threaded environment, then polluting the global space 
is a really big deal.  Imagine two threads executing the template in the same 
context, protected by Locker.  On preemption, the 2nd thread's i variable 
within the loop may be corrupted.

On Jun 12, 2013, at 8:57 AM, Andreas Rossberg <[email protected]> wrote:

> On 12 June 2013 17:35, Michael Schwartz <[email protected]> wrote:
>> How is the template compiler to figure out i is a global reference?
>> 
>> LOTS of code.
>> 
>> That's the point.  The template compiler could be 50 lines using with.
> 
> IIUC, you don't want 'i' to pollute the global name space? Then don't
> use an undeclared variable. Unfortunately, JavaScript allows it, but
> it's a general bug of the language, not specific to templates. Trying
> to "fix" one broken feature with another broken feature is not a good
> idea. Instead, don't use the broken feature. Put a "use strict" into
> the generated code if you want to rule out accidents.
> 
> /Andreas
> 
> -- 
> -- 
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> --- 
> You received this message because you are subscribed to the Google Groups 
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to