Comments (4)
I should mention that the program does run properly on the stopify home page. So it might be that I'm running it incorrectly?
from stopify.
It is definitely a Stopify bug, which should behave correctly regardless of runtime/compiler options.
An equivalent program works correctly on Ocelot:
https://code.ocelot-ide.org/?gist=arjunguha/aefe0f874a10db181eaa610a7c740fad
However, Ocelot does a bunch of other transformations that may be masking the problem.
Looks like the default estimator in Stopify is "velocity", and that the version that you're using is the same version that ElementaryJS uses:
from stopify.
Here is a variation of an example that Leif sent over email, which shows the same problem:
<script src="https://github.com/ocelot-ide/Stopify/releases/download/0.7.3/stopify-full.bundle.js"></script>
<script>
const prog = `
var i = 0;
debugger;
while(i < 10) {
console.log(i);
var G = i + 1;
i = G;
};`;
let runner = stopify.stopifyLocally(prog);
runner.g = {console};
runner.run(() => {
console.log(runner.g.G, runner.g.i);
console.log("DONE!");
});
</script>
If you pretty-print the code around the debugger, you see that the loop body translates to:
if ($__R.mode) {
G = $S.g.i + 1; // BUG HERE: the l-value should be $S.g.G, I believe
$S.g.i = $S.g.G
}
The bug is almost certainly in this file, which introduces the global object:
https://github.com/ocelot-ide/Stopify/blob/master/hygiene/ts/useGlobalObject.ts
I believe the problem is masked in Ocelot, because it wraps the entire program in a thunk (IIRC, though I forget why).
from stopify.
My guess is that loop bodies are considered "scopes" in Babel (which they are for let- and const- bound variables). So, the condition here is probably wrong:
https://github.com/ocelot-ide/Stopify/blob/master/hygiene/ts/useGlobalObject.ts#L91
from stopify.
Related Issues (20)
- Document and verify that flatness annotation work
- Quick Start example broken HOT 5
- Data race bug in PLISS demo HOT 2
- Uncaught capture HOT 4
- Cannot .pause with default estimator
- Build an AsyncRun-like interface for pre-stopified programs HOT 12
- "class" keyword is not supported HOT 7
- Array.flat and Array.flatMap not handled correctly by @stopify/higher-order-functions HOT 2
- Only example from stopify manual fails when using webpack HOT 3
- Memory Leak During Stopified Program Execution HOT 3
- Documentation for compiler/runtime options
- Website Navigation is inconsistant. HOT 1
- Stopify can't run with webpack output. HOT 3
- compile method on class Runner should be public?
- Window object does not affect global enviroment in stopify. HOT 3
- Demo on stopify.org fails to run if modified HOT 1
- stopify.org demo broken again HOT 1
- Pause failing on long-running programms. HOT 4
- [Feature Request] Add onResume to match onYield
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stopify.