-
Notifications
You must be signed in to change notification settings - Fork 12
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
"class" keyword is not supported #471
Comments
Stopify natively supports a limited fragment of JavaScript, which roughly corresponds to ECMAScript 3. The extra stuff you're seeing in Ocelot is accomplishing using Babel. E.g., we use Babel to translate classes to code without classes: Stopify could support classes directly, but it would be more code to maintain, so we didn't bother. |
Thank you for the note! That makes sense from most of the content I've read in the wiki and issues. I'll look into babel and that file to figure out how to set it up for my use case. |
Sure! Warning: I believe Stopify messes up class inheritance. It is a bug that I can investigate if you care about it. It s probably something easy to fix. I use JS classes in an introductory class where inheritance is not taught, so we didn’t bother fixing it. |
(FWIW, I’m surprised the Pyret/stopification project hasn’t been bitten by that. At least the image library uses inheritance quite a bit.) |
We explicitly use Object.create and “old-school” prototype inheritance which seems to be working fine.
…On Sat, Aug 15 2020 at 6:23 PM, Emmanuel Schanzer < ***@***.*** > wrote:
(FWIW, I’m surprised the Pyret/stopification project hasn’t been bitten by
that. At least the image library uses inheritance quite a bit.)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub (
#471 (comment)
) , or unsubscribe (
https://github.com/notifications/unsubscribe-auth/AAA5IU7QDCA24S2OFFGBFHTSA4YKPANCNFSM4P75XFZA
).
|
Ahhh, nice! |
To echo Joe, inheritance works in Stopify. It's that the Babel desugaring of |
Attempting to asyncRun class syntax in the Stopify.org demo or as substituted into one of the Wiki's examples yields errors.
The simple example:
returns the error:
Uncaught TypeError: asyncRun.run is not a function
.It doesn't appear that any of the compiler options listed in the wiki relate to this issue, though I have tried both newMethod options. From digging around past issues it looks like classes were being transpiled with Babel, but also some efforts were made to remove Babel dependencies for web compilers and I cannot follow what changes might resolve the issue though I will keep digging.
Ocelot appears to have full es6 syntax available, so I'm digging around that repo to see if I can't find the solution there.
I have similar errors when using spread syntax
{...spread}
.What am I missing here? Thanks in advance for the pointers.
The text was updated successfully, but these errors were encountered: