Skip to content

feat: Add support for the with statement in strict mode #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

ExE-Boss
Copy link
Collaborator

This makes it possible to use both the with statement and strict mode together by nesting a strict IIFE inside a with statement:

with (locals) {(function () {"use strict";
	// Actually runs in strict mode
	var isReallyStrict = !((function () { return this; })());
	console.assert(isReallyStrict === true);
})()}

Because this is probably an ugly hack, it requires _with, strict and the new allowStrictWith option to all be set to true.

@mde
Copy link
Owner

mde commented Aug 24, 2019

Is there some specific reason someone would want to do this? Really prefer avoiding adding new complexity, more runtime options, particular for something already being described as "probably an ugly hack."

@ExE-Boss
Copy link
Collaborator Author

The reason being, I’d like to migrate KumaScript macros to run in Strict Mode, but the current implementation would require changing everything to use the locals. namespace.

@ExE-Boss
Copy link
Collaborator Author

I’ve got a better idea on how to achieve what I intend.

@ExE-Boss ExE-Boss closed this Aug 24, 2019
@ExE-Boss ExE-Boss deleted the feat/strict-with-hack branch September 5, 2019 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants