jsx/JSX

Can users set strict mode in JSX?

yosuke-furukawa opened this issue · 5 comments

I published a JSX module implements Object.freeze in yesterday.

https://github.com/yosuke-furukawa/freezer.jsx

However, Object.freeze do not throw exception in non-strict mode.

I would like to know how to set 'use strict' in JSX.

I have found a way to set strict mode in node.js.

--use_strict option is enabled in node.js runtime.
If this option enable, the program become strict mode inspite of "use strict"; or not.

Thank you for your contribution. Did the generated code run under strict mode?

IMO we should better always set use strict in the generated code, but I am not confident enough that it would not introduce any compatibility problem nor have any impact on execution speed.

FYI The code generated by JSX is not compatible with strict mode. You can see some tests failing in branch: https://github.com/jsx/JSX/tree/kazuho/experiments/use-strict

@kazuho

As tested your branch on my environment (v0.11.11), I don't see any warning or test failures. Which test case did you see failing?

@yosuke-furukawa @wasabiz

Sorry.

You need to run JSX_RUNJS='node --use_strict' make test on the aforementioned branch (kazuho/experiments/use-strict).

I have fixed subtle issues re compatibility with strict mode, but there are still problems.