PistonDevelopers / dyon

A rusty dynamically typed scripting language
Apache License 2.0
1.76k stars 56 forks source link

Add WASM Support #702

Closed codehz closed 2 years ago

codehz commented 2 years ago

hmm, just cut down all thread usage when targeting to wasm(or disabled threading feature) (including go and in expression

bvssvni commented 2 years ago

To fix the build and the compiler warning:

bvssvni commented 2 years ago

I have an idea for improving the design of ModuleResolver, but this can be done in another PR. The idea is to use a function pointer instead of trait, which means we can get rid of the Box<dyn ModuleResolver>, which when not optimized by the compiler produces an extra allocation (FileModuleResolver has size 0, so it should be optimized away).

bvssvni commented 2 years ago

I think using feature on lifetime::Kind is going too far, as it duplicates some code that is hard to maintain.

bvssvni commented 2 years ago

I also have an idea of using empty type pattern in ast/mod.rs, but this can be done in another PR.

bvssvni commented 2 years ago

I'll merge this and make the changes in another PR.

Merging.

bvssvni commented 2 years ago

Thanks!