Skip to content

Change Duktape to QuickJS for ES6 features. #1191

Closed
@Kozova1

Description

@Kozova1

QuickJS supports way more ES6 features than Duktape, some of which would help developers.

I have a repository that demonstrates using QuickJS when embedded in C, with a C module that can be imported from JS, if that helps.

Activity

Kozova1

Kozova1 commented on Sep 27, 2020

@Kozova1
Author

This is a possible way to close issue #1129

Kozova1

Kozova1 commented on Sep 27, 2020

@Kozova1
Author

I'm working on a PR that will introduce QuickJS as an option (new qjs or new qjavascript).

nesbox

nesbox commented on Sep 27, 2020

@nesbox
Owner

We could replace Duktape with QuickJS if all the JS carts will work.

Kozova1

Kozova1 commented on Sep 27, 2020

@Kozova1
Author

It should be possible to add functions to a global scope instead of inside a module using JS_GetGlobalObject(), JS_SetPropertyStr(), and JS_NewCFunction(). In that case, all JS carts should still work perfectly.

my fork at https://github.com/Kozova1/TIC-80.git uses the ES6 module system, and hides away all the builtin TIC-80 functions inside the tic80 module.
Unfortunately, my fork has some memory bugs because of my shitty implementation, so until they're solved it should not be merged (since it just crashes immediately if it doesn't get a JS exception).

RobLoach

RobLoach commented on Mar 1, 2021

@RobLoach
Contributor

Duplicate #874

joshgoebel

joshgoebel commented on Nov 4, 2021

@joshgoebel
Collaborator

Agree. Recommend we close as dup.

Edit: Keeping this thread instead since it has more content.

joshgoebel

joshgoebel commented on Jan 9, 2022

@joshgoebel
Collaborator

@Kozova1 Did you ever make any more progress? Anything specific you need help with?

Kozova1

Kozova1 commented on Jan 9, 2022

@Kozova1
Author

Didn't really make any more progress. Some help with how exactly to use QuickJS would be great since last time I checked the docs aren't really great.

joshgoebel

joshgoebel commented on Jan 9, 2022

@joshgoebel
Collaborator

Yeah seems you'd have to read and learn from the examples. If you had a very specific question feel free to ask here.

rdeforest

rdeforest commented on Jan 25, 2023

@rdeforest

I'm interested in this as a way to make using CoffeeScript easier. Currently I'm using Babel and Rollup and some magical incantations just so I can require() a module of code shared amongst my various toys.

If this moves forward I might be tempted to contribute a hack to make CoffeeScript work in TIC 'natively': write CoffeeScript in the editor, translate it to JS behind the scenes.

joshgoebel

joshgoebel commented on Jan 25, 2023

@joshgoebel
Collaborator

I personally don't think we should support transpiled languages... gotta draw the line somewhere.

RobLoach

RobLoach commented on Jan 25, 2023

@RobLoach
Contributor

Moonscript is in there ๐Ÿคท... CoffeeScript is pretty old tho lol

joshgoebel

joshgoebel commented on Jan 25, 2023

@joshgoebel
Collaborator

Yeah, maybe too old is a better argument. :-). I think we need SOME criteria though. I don't think "add every language someone writes a PR for" is a maintainable long-term strategy since already we can see where this is falling down with languages like JS not getting updated... we have no one/few willing to do the hard long-term maintenance work.

Anrock

Anrock commented on Aug 1, 2023

@Anrock
Collaborator

Yeah, maybe too old is a better argument. :-). I think we need SOME criteria though. I don't think "add every language someone writes a PR for" is a maintainable long-term strategy since already we can see where this is falling down with languages like JS not getting updated... we have no one/few willing to do the hard long-term maintenance work.

Wasn't there an idea to leave only WASM interpreter in TIC-80 and thus have support for any language that supports compiling to WASM without having to maintain each language interpreter in TIC-80?

self-assigned this
on Aug 4, 2023
joshgoebel

joshgoebel commented on Aug 4, 2023

@joshgoebel
Collaborator

Wasn't there an idea to leave only WASM interpreter in TIC-80

No, I don't think the goal was ever "WASM only"...

added a commit that references this issue on Aug 5, 2023

#1191: Duktape changed to QuickJS

added a commit that references this issue on Aug 7, 2023

#1191: added promises calling to the main loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

    Participants

    @joshgoebel@RobLoach@nesbox@Anrock@rdeforest

    Issue actions

      Change Duktape to QuickJS for ES6 features. ยท Issue #1191 ยท nesbox/TIC-80