Live data from Hacker News

Rust Survey 2021 Results

blog.rust-lang.org

121–130 of 135 posts

Re: Rust Survey 2021 Results

#121
post #110

Earlier 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…

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

#122
post #108

Earlier quoted context omitted.

Kind of, Python, C#, Java have enough stuff on language + standard library to compete with C++. A pub quizz with them would be just as fun.

I personally think those are all nowhere close. There are like ten different ways to initialize values in C++ and they all have slight differences.

Believe me, C# 10, Java 17 and Python 3.7, including standard library and runtimes across 25 - 30 years, have plenty of question material.

Re: Rust Survey 2021 Results

#123
post #83
post #11

Earlier quoted context omitted.

The problem with that is in large parts that Haskell 98 is very outdated, and so relatively basic and absolutely useful extensions are in the same pot as all the experimental stuff. Haskell Prime, essentially the Haskell 98 successor, is supposed to fix that. The first thing I do in almost any Haskell project is enable a bunch of extensions that I consider absolutely essential[1]. Most or all of those should likely b…

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 extension.

Re: Rust Survey 2021 Results

#124
post #89

I have some time between contracts and I've found myself learning rust. Pros: - Sum types. I am an OO apologist, but trying to use classes in C++ is an exercise in frustration. Sum types map very well to union types and are a better fit for systems programming. - Unit tests built right into the language - it seems like a small thing but it's a hassle in most languages to choose a library, set it up etc. - The above,…

Re: knowledge transfer. Why do you expect your C knowledge to transfer to Rust? Let me tell you clearly: it doesn't. It's not because Rust uses different terminology. Rather, Rust uses different terminology because underlying concept is different, so using same terminology would only lead to confusion. I found this to be the case: Rust is equally hard to learn, for C programmers and for Java programmers. But C progra…

I expected (or should I say hoped) C knowledge would transfer because - that's my main point of reference for a programming language where you care about memory.

I don't think there's anything particularly unusual about it - were I to seriously learn haskell, I'd hope whatever knowledge I had of Ocaml would put me in a good position.

Your blog was spot on - with the caveat that people who know C++ can easily "learn" stuff like Java and C# but tend to write very C++ flavoured Java and C#.

Re: Rust Survey 2021 Results

#125
post #65
post #11

Earlier quoted context omitted.

The problem with that is in large parts that Haskell 98 is very outdated, and so relatively basic and absolutely useful extensions are in the same pot as all the experimental stuff. Haskell Prime, essentially the Haskell 98 successor, is supposed to fix that. The first thing I do in almost any Haskell project is enable a bunch of extensions that I consider absolutely essential[1]. Most or all of those should likely b…

I think the GHC2021 group of blessed extensions provides what you want. https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/cont...

That's indeed useful and something that I didn't know about, thank you!

Re: Rust Survey 2021 Results

#126
post #47

Earlier quoted context omitted.

Yeah, the await syntax is just bizarre. One of the worst eyesores of any languages I've personally encountered. An await macro or function would have sufficed but because Rust is still mainly a hipster language with a hipster community, they had to choose a hipster syntax after years of bikeshedding about how to make it absolutely perfect.

> An await macro or function would have sufficed We tried, and it literally did not suffice.

Works in other languages fine.

Re: Rust Survey 2021 Results

#127

Earlier quoted context omitted.

> An await macro or function would have sufficed We tried, and it literally did not suffice.

Works in other languages fine.

Different languages have different semantics. The challenges here are related to the ways Rust works specifically, as well as its goals.

Re: Rust Survey 2021 Results

#128
post #59

Rust 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

#129
> The next largest concern was that the language would become too complex (33%).

I'm also in this camp, although I would go further to say that Rust is already "too complex." Or maybe not. Go has already done an excellent job of being a very simple and effective language. Rust's complexity makes it very useful for some cool stuff. Like building DSL's.

But because of its complexity, Rust is not the language I would reach for in most cases when building almost anything pretty standard, like a basic web app backend. For that, I would choose Go over Rust every time. The reason being: the cognitive load of Go is far, far lower, and that is super important for maintainability and being able to collaborate with others.

Basically, in the Venn diagram of what Rust can do and what Go can do, I'd mostly use Rust only for what it can do well and Go can't. For example, a real time system that can't have GC overhead. Or sometimes I'll choose it anyway for my hobby projects, just 'cuz I think it's cool and want to use it. But if I put on my pragmatism/business hat and want to build anything seriously, that's the way it will go.

Take that for what it's worth since I'm very new to Rust (and I quite like it actually!). Although I have a lot of experience with a lot of other languages including C/C++, Java, Go, Perl, JS/TS, Python, and more. Rust is up there as one of the more complex languages I've used. I've really noticed it on the learning curve so far. Reminds me a lot of Scala, actually.

The onboarding experience of Go vs Rust is night and day. You can legitimately go from reading "A tour of Go" to understanding most Go projects within a day (if you're already an experienced programmer). And it's not because Rust is lacking good learning resources. It has amazing docs and so many amazing free resources. I'm honestly enjoying and learning a lot about it rather quickly, I think. But it's still taking a long time and I can see I'm in for a ride and will be going "oh wtf is that" in Rust source code for a very long time!

Re: Rust Survey 2021 Results

#130
post #21

Earlier quoted context omitted.

As someone with 20 years of C++ experience, in industries from everything from real-time systems through to low-level HPC graphics on CPU/GPU (currently in VFX), I really don't understand the hatred for OO programming, and I must be either missing something, or being lucky with the codebases I'm working on... It's a tool for encapsulation: you can get into trouble with it, but I'd argue the same is possible with many…

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

Post reply on HN