Comments (4)
I can't think of something better than unsafe. I think unsafe is sometimes used in rust even when memory safety is not at issue (but only correctness). I think that bypassing compile-time guarantees could qualify as unsafe. e.g. interpreting a 32-bit integer as a f32 is unsafe, even though it cannot lead to any memory corruption issues. It's only unsafe because it might give different answers on different architectures. But broadly speaking, dimensioned is preventing precisely the same kind of thing: accidentally treating a value as a different type of value.
from dimensioned.
Rust's unsafe
keyword is not so much about memory safety as it is about Undefined Behavior, and I feel that this usage of the term cheapens its meaning. I hope you may still consider changing this before an eventual 1.0.
I do not feel there needs to be a single term for this applicable in all contexts; one could call the member value_raw
(or to really discourage its use, something unwieldy like internal_value
). The phrase "dimensionally unsafe" can be replaced with phrases like "dimensionality is (un-)checked".
Re: integers to floats, f64::to_bits
and from_bits
(stabilized in 1.20) are unapologetically marked safe. There's a note on the latter that it may or may not mask signalling NaNs... but to my understanding, the question isn't whether or not Rust wants to provide "no signalling NaNs" as a guarantee, but rather, it's because nobody in the community really knows whether LLVM (or other platforms) considers them to invoke UB.
from dimensioned.
Unsafe it is!
from dimensioned.
Reopening this issue to be considered for the next batch of breaking changes (which will likely be when const generics are a thing).
from dimensioned.
Related Issues (20)
- Add support for absolute values HOT 2
- Implement various functions on primitives.
- Use #[rustc_on_unimplemented] HOT 1
- travis fails to build HOT 2
- Re-add rustfmt and clippy to TravisCI build HOT 1
- Update `approx` dependency
- Validate and ideally repace uses of `mem::transmute`
- Typo in UCUM: MH20
- http://paholg.com/dimensioned/ is a 404 HOT 3
- Question: accepting generic dimension for calculation in specific units HOT 11
- Question: working with nalgebra HOT 7
- Feature request: Celsius HOT 5
- support std::iter::Sum. HOT 1
- Any good idea how to integrate with `ordered_float`? HOT 3
- Use conventional letter case HOT 1
- Support f256 via the qd github repo HOT 15
- fmt String as Joules instead of MKS HOT 2
- has_units() -> bool HOT 2
- Implement `max` and `min` functions for primitive types that have them HOT 1
- `serde_test` should be dev-dependency
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 dimensioned.