Comments (13)
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.
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.
@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.
@koute would it be reasonable to make wasm-bindgen
a hard dependency for wasm32-unknown-unknown
now?
from getrandom.
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.
@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.
@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.
@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.
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.
#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.
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.
Thanks for the clarification @newpavlov.
from getrandom.
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)
- Cannot compile with rust 1.70 and x86_64-unknown-linux-musl target HOT 15
- Support for non-blocking getrandom HOT 2
- Hash pin github workflow dependencies HOT 4
- Constant `__getrandom_internal` should have UPPER_SNAKE_CASE name, e.g. `__GETRANDOM_INTERNAL`rust-analyzernon_upper_case_globals HOT 3
- What versions do platform support track? HOT 4
- Broken link to sys_read_entropy HOT 4
- Rust embedded standard library (no_std) target is not supported HOT 9
- Don't fall back to file I/O on Linux when Rust only supports kernels guaranteed to have it HOT 5
- Potential undefined behavior in hermit implementation. HOT 3
- Cannot use synchronous feature in node 18 HOT 7
- Add support for targets without atomic operations
- Support for UEFI HOT 3
- Failed to build for wasm32-unknown-unknown with no_std HOT 1
- Is the ESPIDF implementation actually correct? HOT 3
- Spurious failures of Web tests on Windows HOT 1
- Port from libc to rustix HOT 7
- Remove file-based RNG fallback on DragonflyBSD HOT 1
- man7 link should be replaced
- The newly updated version "0.2.13" cannot run on mipsel HOT 7
- Error: target is not supported (cargo build-bpf) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from getrandom.