robertkrimen / otto

A JavaScript interpreter in Go (golang)
http://godoc.org/github.com/robertkrimen/otto
MIT License
8.01k stars 584 forks source link

"use strict" is not in effect #492

Open slrem opened 1 year ago

slrem commented 1 year ago

"use strict" is not in effect

donatj commented 1 year ago

It’s an ES3 runtime. "use strict" is an ES5 feature.

Asday commented 1 year ago

What? It's an ES5 runtime with the caveat that "use strict"; has no effect.

"use strict" will parse, but does nothing. Otto targets ES5

https://github.com/robertkrimen/otto#caveat-emptor

stevenh commented 1 year ago

I believe what @slrem is trying to say is that while "use strict" parses, it doesn't produce the desired effect and prevent the use of undeclared variables for example, which while documented isn't ideal.

Is that the case @slrem?

Asday commented 1 year ago

That was my understanding too - my hope was that quoting both lines from the README would answer both posts. I should have @'d people to be clear.

slrem commented 1 year ago

yes

stevenh commented 1 year ago

Happy for someone to put in a PR that addresses this current short coming.

stevenh commented 1 year ago

I'll keep this open so people can see that it's something that they can help contribute to.