4 ms·
would it be possible, for example, to access the standard decimal library of C# or Python via Javascript, thus not having to wait for the TC39 spec / implementa
by dlojudice 4y ago
would it be possible, for example, to access the standard decimal library of C# or Python via Javascript, thus not having to wait for the TC39 spec / implementation? [1]
[1] https://github.com/tc39/proposal-decimal https://github.com/tc39/proposal-decimal
- syrusakbary 4y agoDecimal values are not currently represented as a first-class type by WAI (as int, floats or string types are) but I believe it would be a great idea to do so. Would you mind opening an issue in the WAI repository [1] so we can follow up there? Thanks! [1] https://github.com/wasmerio/wai https://github.com/wasmerio/wai
- duped 4y agoWould this come under the WASI component model?
- the_duke 4y agoThe code you want to use has to compile to Webassembly. This is in fact possible for C# and Python, but especially in the browser you would want to have a small binary size, and avoid bringing along the whole runtime of these managed languages if all you want is a small functionality subset. A very viable solution would be creating a decimal package with either a native Rust crate (I think there are a few decimal implementations) or with one of the goto C libraries. That would be much smaller and faster as well.
- TachyonicBytes 4y agoIn her wasm summit presentation [1], Ashley Williams had a slide that showed a different picture. AssemblyScript came out with the smallest footprint, while Rust and C (through Emscripten) had bigger footprints--the slide is qualitative. An article posted last week on HN [2] also seems to support this hypothesis, this time with some numbers. The AssemblyScript program had 6% the filesize of the Rust program. So it seems like, if you want small wasm libraries, AssemblyScript may be your best shot. [1] https://youtu.be/J5Rs9oG3FdI?t=2133 [2] https://news.ycombinator.com/item?id=33761756
- the_duke 4y agoRust isn't exactly known for it's small code size, due to bounds checks, heavy encouragement of using generics, ... Although it has to be said that you can get Rust code to be really small if you know what you are doing and work towards it. But I recommended Rust or C because there are reasonably mature decimal implementations. No idea if there is one for Assemblyscript.