Skip to content

ES6 Support #508

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

Closed
hhugo opened this issue Jul 31, 2016 · 15 comments · Fixed by #1391
Closed

ES6 Support #508

hhugo opened this issue Jul 31, 2016 · 15 comments · Fixed by #1391

Comments

@hhugo
Copy link
Member

hhugo commented Jul 31, 2016

http://es6-features.org

related to

@dannywillems
Copy link
Member

Something new about ES6 support?

@hhugo
Copy link
Member Author

hhugo commented Sep 12, 2016

no. I don't have time to work on this now. What's your use case ?

@dannywillems
Copy link
Member

No real use case for the moment but as lots of popular JavaScript frameworks switch to ES6 (like React and ReactNative), it would be great to have ES6 support.
I would like to begin a binding to ReactNative and use the ES6 interface is easier.

@hhugo
Copy link
Member Author

hhugo commented Dec 11, 2018

One way would be to rely on some external javascript parser (https://github.com/facebook/flow ?)

@kevinji
Copy link
Contributor

kevinji commented Mar 23, 2019

Just for comparison: BuckleScript also compiles to ES5, but supports ES6 modules.

@jmcarthur
Copy link

WeakSet and WeakMap seem exciting to me.

@hhugo
Copy link
Member Author

hhugo commented Nov 1, 2020

How are WeakSet and WeakMap related to this issue ? My understanding is that one can already use them to write bindings.

@hhugo
Copy link
Member Author

hhugo commented Nov 1, 2020

I'm fact, they are already used in the jsoo runtime.
See

this.objs = []; this.lookup = new joo_global_object.WeakMap();

@jmcarthur
Copy link

Ah, I had thought the reason js_of_ocaml didn't support Weak was just because JavaScript doesn't support any form of weak references, but maybe I'm just wrong. Maybe it's just that either (1) things were different in the past or (2) WeakMap/WeakSet are somehow not sufficiently powerful.

@hhugo
Copy link
Member Author

hhugo commented Nov 2, 2020

Indeed, the ocaml weak reference semantic cannot be implemented using weak map / weak set

@jmcarthur
Copy link

Oh, I see, WeakMap and WeakSet are not what I expected them to be. Their keys are weak!

I have now also learned about WeakRef, but it looks like browser support is still quite limited.

@jasongitmail
Copy link

It might be worth revisiting this in 2021.

Because the output uses Common JS, it can be difficult to integrate with existing projects that use modern, ES6 style JavaScript. ES6 would also allow the JS to work client-side or server-side by default, since browsers now have broad ES6 support.

@hhugo
Copy link
Member Author

hhugo commented Sep 22, 2021

One could try to port new js feature implemented in https://github.com/returntocorp/pfff/blob/develop/lang_js/parsing/parser_js.mly

@hhugo
Copy link
Member Author

hhugo commented Jan 18, 2023

Oh, I see, WeakMap and WeakSet are not what I expected them to be. Their keys are weak!

I have now also learned about WeakRef, but it looks like browser support is still quite limited.

WeakRef are now used to implement the ocaml weak semantic.

@hhugo
Copy link
Member Author

hhugo commented Jan 18, 2023

#1386 allows to parse utf8 identifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants