Earlier quoted context omitted.
Out of curiosity, why do you find ScopedTypeVariables essential? I've written a fair amount of Haskell code and never once needed it.
Here's some explanation (not by me, found through search): https://blog.ocharles.org.uk/guest-posts/2014-12-20-scoped-t... And among other things, it also enables pattern signatures. The official docs at https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/scop... are generally worth a read, they start out with an example of what lexically scoped type variables allow, and follow with the design principles for the…
Rust Survey 2021 Results
131–135 of 135 posts
Re: Rust Survey 2021 Results
#132Rust is a terribly slow language to write in, especially if you’re trying to fight it in any way - because you‘ll lose. It’s verbose and quite ugly as it tries to appeal to C family programmers while being expression and pattern based. When trying to resolve ownership issues with closures the first time, you‘ll be doubting whether Rust is in fact a language or just a sick elaborate joke that tries to mock you for eve…
I feel like some others aren't seeing the humour in your comment. Or maybe I'm just weird. Orr maybe I'm new enough to Rust still that I don't get offended. Anyways, you got a laugh from me at least!
Re: Rust Survey 2021 Results
#133Earlier quoted context omitted.
One of the pieces of OO _inheritance_ I deeply miss in Rust is the ability to subclass a library class, override *one* function, and retain all the other functionality. Yesterday, I needed to tweak the behavior of one function on actix-identity's cookie and my option seemed to be to wrapper the original object and write the same interface for the entire object, passing through every function except the one I wanted t…
You don't necessarily need inheritance. Kotlin for example has a feature wherein all that forwarding boilerplate you had to write is automated. https://kotlinlang.org/docs/delegation.html
Re: Rust Survey 2021 Results
#134Earlier quoted context omitted.
I guess one way would be via delegation, similar to how COM does it. I bet with a couple of macros it would be possible to automate what languages on Windows can somehow do magically with COM interfaces.
You don't need any macros, it can be accomplished with the trait system[1], either manually or through auto-deref. Some of the boilerplate could be generalized with a derive proc-macro or a macro-by-example call but it is not absolutely necessary. [1]: https://play.rust-lang.org/?version=stable&mode=debug&editio...
Re: Rust Survey 2021 Results
#135Earlier quoted context omitted.
Serious question about Zig’s comptime - isn’t that just like Rust’s const fn, except every function is implicitly opted in to being const? Where this could be a problem - I write a comptime function, only using other functions that I’ve verified can be executed at compile time. But now the implementation details of those functions (that they’re comptime) has leaked to their definition. Now a change to the impl of tho…
Kinda, but much more than that and the ergonomics are quite different as the entire language is basically available. For example in Zigs comptime, types are first class citizens which can be queried and operated on. This gives you generics without a lot of type system magic, and even const generics over arbitrary types. All without a macro system or Turing-Complete type checking (similar in flavour to the DeBruijn cr…
#[cfg(target_arch = "x86_64")]
…
#[cfg(target_arch = "aarch64")]
…
#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))]
compile_error!("unknown arch!");
(If you got to much more complex cfg branches, cfg-if could be worthwhile, which lets you write `cfg_if! { if #[cfg(…)] { … } else if #[cfg(…)] { … } else { … } }`. But for only a few simple ones, I prefer to keep it out.)