Comments (2)
Expected Behavior
https://scratch.mit.edu/projects/116680081/ should work
Actual Behavior
It errors with
Uncaught RangeError: Maximum call stack size exceeded
This seems to be caused by the project using recursion as an alternative to repeat something 40,000 times.
We are limited by the call stack size of the browser because we use actual JS recursion, whereas Scratch's interpreter uses a list that allows essentially infinite recursion.
Steps to Reproduce
https://turbowarp.org/116680081
Operating System and Browser
Happens in all browsers.
Could you detect when you're close to reaching the limit and start a new thread with a reference to the original context using setTimeout()
? Also, it seems like
scratch-vm/src/compiler/jsexecute.js
Line 581 in 6aeccdb
from scratch-vm.
setTimeout is not useful here and that line of code is not the problem
I know perfectly well how to solve this (continuations instead of generators, like forkphorus). Solving this requires many changes, only affects a few projects, and makes everything much slower, so it won't happen any time soon
from scratch-vm.
Related Issues (20)
- about util.ioQuery HOT 3
- pen optimisation HOT 3
- Upload To Scratch HOT 4
- Weird Blocks HOT 3
- Custom Reporters - I dunno if this is my fault, but this makes no sense HOT 3
- Broadcasts get compiled dynamically HOT 8
- Suggestion: Compile broadcasts once per project start HOT 4
- Bug: `util.thread.peekStack()` is not working properly when there are nested reporters
- Compiler's waitPromise soft-lock if promise handlers executed immediately HOT 2
- New Argument: Block HOT 4
- vm crash HOT 2
- Global blockUtility HOT 4
- Native sb3fix integration
- Custom reporters can hang browser in certain situations. HOT 2
- Compiler Support HOT 3
- Request: Allow unlimited cloud variables on unpackaged projects. HOT 4
- Glide-to blocks don't pause when a project is paused
- Optimize namesOfCostumesAndSounds
- Procedure variant by argument types
- Optimize getSpriteTargetByName HOT 2
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 scratch-vm.