-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
I'll preface this by saying I like Rust, and I've found myself coding more in Rust the last two years than anything else. But Rustaceans kind of like to laugh at Go, because it's not as expressive or elegant a language by comparison. That's mostly true, think of how nicely Option types, enums, and iterators work in Rust compared to Go. However, Go is simple and deeply pragmatic. There is an underrated value in that. Some parts of Rust are starting to remind me of the horror I ran from with C++. Look at this:
Update: It is possible to abuse existing CoerceUnsized implementations on stable. See #85099 (although I created that issue before reading any of this issue and its IRLO thread, so don’t expect any syntactic similarity to the unsoundness examples of this issue).
The type Pin<&LocalType> implements Deref but it doesn’t implement DerefMut. The types Pin and & are #[fundamental] so that an impl DerefMut for Pin<&LocalType>> is possible. You can use LocalType == SomeLocalStruct or LocalType == dyn LocalTrait and you can coerce Pin> into Pin>. (Indeed, two layers of Pin!!) This allows creating a pair of “smart pointers that implement CoerceUnsized but have strange behavior” on stable (Pin<&SomeLocalStruct> and Pin<&dyn LocalTrait> become the smart pointers with “strange behavior” and they already implement CoerceUnsized).
More concretely: Since Pin<&dyn LocalTrait>: Deref, a “strange behavior” DerefMut implementation of Pin<&dyn LocalTrait> can be used to dereference an underlying Pin<&SomeLocalStruct> into, effectively, a target type (wrapped in the trait object) that’s different from SomeLocalStruct. The struct SomeLocalStruct might always be Unpin while the different type behind the &mut dyn LocalTrait returned by DerefMut can be !Unpin. Having SomeLocalStruct: Unpin allows for easy creation of the Pin> which coerces into Pin> even though Pin<&dyn LocalTrait>::Target: !Unpin (and even the actual Target type inside of the trait object being returned by the DerefMut can be !Unpin).
Methods on LocalTrait can be used both to make the DerefMut implementation possible and to convert the Pin<&mut dyn LocalTrait> (from a Pin::as_mut call on &mut Pin>) back into a pinned mutable referene to the concrete “type behind the &mut dyn LocalTrait returned by DerefMut”.
https://github.com/rust-lang/rust/issues/68015#issuecomment-835786438
Rust doesn’t handhold you for anything low-level. It’s just that Rust hides all that complexity beneath Unsafe Rust, which is an eldritch abomination of a language that no one quite knows all the rules yet… I hope the MiniRust project (https://github.com/RalfJung/minirust) succeeds in writing a formal spec of it someday.
> Rust and Swift are not really competing in the same space.
Rust is trying competing yes, Swift is not trying to compete, they use it, they do what they have to do [1]
What happened to Mozilla's Rust plan with Firefox? so far, no bueno
> And nobody trusts Apple for cross-platform support.
Swift supports a wide range of targets and architectures [2]
They officially provide release build for all major OSs [3]
[1] - https://github.com/apple/swift/blob/main/docs/OwnershipManif...
[2] - https://github.com/apple/swift/blob/aff7c14d92fd241aff85ba4c...
[3] - https://www.swift.org/download/