Skip to content
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

JS scope in Prolog #1

Open
jbolten opened this issue Feb 20, 2023 · 1 comment
Open

JS scope in Prolog #1

jbolten opened this issue Feb 20, 2023 · 1 comment

Comments

@jbolten
Copy link

jbolten commented Feb 20, 2023

I tried the following code and expected to get a result of
2
2
on the console. But instead i got
2
1

<script>
	var y = 1;
	var f = function(){
		    var y=2;
		    console.log(y);
		    Prolog.call("_ := 'console.log(y)'.");
		}
</script>

What about scope in swi-prolog-wasm? Can I hand over scope to Prolog?

@JanWielemaker
Copy link
Owner

This is probably more something for the discourse forum. But yes, Prolog calls are interpreted in the global context. No clue whether that can be changed.

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

No branches or pull requests

2 participants