Git Product home page Git Product logo

Comments (13)

newpavlov avatar newpavlov commented on June 10, 2024 3

I am strongly against making wasm-bindgen enabled by default for wasm32-unknown-unknown. As I wrote several times, this target can not make any assumptions about a target on which it will be executed. It can be a browser, Node.JS, smart-contract, game module system and who knows what else. If we want to simplify WASM builds for browsers/Node.JS, let's push for dedicated targets instead.

from getrandom.

newpavlov avatar newpavlov commented on June 10, 2024 1

I don't see why we should use web_sys while it's built on top of wasm-bindgen, instead of directly using the latter.

Previously WASM target was discussed in #17 and we decided to keep it as-is for the time being. Also see this comment.

from getrandom.

newpavlov avatar newpavlov commented on June 10, 2024 1

@najamelan
We don't have those hypothetical new targets yet, so it's hard to tell if stdweb will work on them. IIRC it can work on other existing WASM/asm.js targets, but we don't use it on them. Don't forget that people use wasm32-unknown-unknown outside of browsers, and even on browsers not everyone uses wasm-bindgen in their build pipeline.

Ideally I would like to drop feature-gated support for wasm32-unknown-unknown altogether, but I think it will have to wait until #4 and #21 gets properly solved.

from getrandom.

dhardy avatar dhardy commented on June 10, 2024

@koute would it be reasonable to make wasm-bindgen a hard dependency for wasm32-unknown-unknown now?

from getrandom.

najamelan avatar najamelan commented on June 10, 2024

If stdweb does not give any advantage over wasm-bindgen, and if it can't lead to less deps being pulled in, this would greatly simplify issues downstream... I mean to just get the random data out of wasm-bindgen without features.

from getrandom.

najamelan avatar najamelan commented on June 10, 2024

@newpavlov Does setting stdweb work on these other platforms?

Or are you just thinking other features like wasm-bindgen and stdweb will maybe be added later? Or do these targets just need to use dummy and they are not supported?

from getrandom.

dhardy avatar dhardy commented on June 10, 2024

@newpavlov both our wasm-bindgen and stdweb impls support both browsers and Node.js, with run-time failure on other platforms. IMO this is about as good as is possible for the inspecific wasm32-unknown-unknown target. These impls can potentially be extended to support other interfaces — though likely smart contracts and game modules would either use one of the same interfaces or not support randomness at all. So I don't buy your argument.

Of course I agree that ideally more specific targets will replace the unknown.

from getrandom.

newpavlov avatar newpavlov commented on June 10, 2024

@dhardy
Yes, wasm32-unknown-unknown is PITA right now for us and our users. (Overall I think that making it an std target was probably a mistake, motivated by a short-term goals...) But I don't think we should make conceptually wrong compromises (otherwise why shouldn't we support some popular RNG perfirial for embedded ARM targets?). Instead, in my opinion, we should use this pain to motivate Rust improvements.

Yes, this approach is more painful and less convenient in a short-term, but should be more beneficial in a longer term.

from getrandom.

TitanThinktank avatar TitanThinktank commented on June 10, 2024

with some effort from the titans of industry wasm32-unknown-unknown can easily dethrone Java and dotNet VMs, but there are dark forces at work who prefer to block and ban those who dare to speak up rather than showing support for the betterment of entire programing landscape.

from getrandom.

dhardy avatar dhardy commented on June 10, 2024

#102 addresses half of this issue. To address the other half, we could just make the stdweb feature a synonym for wasm-bindgen since I think there will be no remaining reason to keep both implementations?

from getrandom.

newpavlov avatar newpavlov commented on June 10, 2024

@dhardy
Citing @koute:

Even though stdweb will be compatible with wasm-bindgen there are still people who do not use wasm-bindgen. <..> and some people target wasm32-unknown-unknown through cargo-web (so without going through wasm-bindgen).

from getrandom.

dhardy avatar dhardy commented on June 10, 2024

Thanks for the clarification @newpavlov.

from getrandom.

josephlr avatar josephlr commented on June 10, 2024

Closing this as we've gone with custom RNG crates to handle the issues on the wasm32-unknown-unknown target, see #109. For getrandom 0.2, building for wasm32-unknown-unknown will result in a compile-error by default. However, users can opt-in to using either a wasm-bindgen or stdweb implementation with getrandom.

from getrandom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.