Live data from Hacker News

Still in love with Rust

dpc.pw

141–150 of 186 posts

Re: Still in love with Rust

#141
post #112

Earlier quoted context omitted.

Languages features, dependencies, etc. For instance one project: error[E0010]: allocations are not allowed in constants error[E0015]: calls in constants are limited to tuple structs and tuple variants Another: error: could not find native static library `brotli`, perhaps an -L flag is missing? error: aborting due to previous error error: Could not compile `brotli-sys`. And I'm not talking what happens if you don't fi…

Allocations were never allowed in constants, so I find that first one quite confusing. Any chance you can share the code? And the second one is because a system library is missing. You're saying you have it installed, and it used to build, but does no longer?

For first one:

    const characters: Vec = vec!['7', '+', '-', '*', '/', '^', '0'];
For the second, I do have brotli installed (via brew) and I have no idea why it can't find it now. It used to build. Note that I don't use brotli directly but it comes as one of the 274 dependencies (!) of that code. npm again...

Re: Still in love with Rust

#142
post #141

Earlier quoted context omitted.

Allocations were never allowed in constants, so I find that first one quite confusing. Any chance you can share the code? And the second one is because a system library is missing. You're saying you have it installed, and it used to build, but does no longer?

For first one: const characters: Vec = vec!['7', '+', '-', '*', '/', '^', '0']; For the second, I do have brotli installed (via brew) and I have no idea why it can't find it now. It used to build. Note that I don't use brotli directly but it comes as one of the 274 dependencies (!) of that code. npm again...

Thanks, this is very helpful.

Do you know when the first one ever compiled? I tried it on Rust 1.0, and on every version from 1.20-1.30, and it always failed.

Ah, bummer. I haven't used the brotli lib, but that is unfortunate.

Re: Still in love with Rust

#143
post #45

Earlier quoted context omitted.

> Python formatting is egregious though, with hopelessly long lines This is the result of writing hopelessly long lines of code. Python doesn't force you to write long lines. I've done it myself, many times, but gradually made efforts to avoid this. I'll move deeply indented code into a new function or split up a long expression with a temporary variable. If I run into a particularly hard-to-format portion of code, i…

But list/dict comprehension puts the programmer in bad shoes, because anything interesting/powerful done with it gets dangerously long. This and other features where non-trivial statements or calls are written seem poorly thought-out, from a formatting perspective (nevermind 120 columns being the style goal for the language and common IDEs, already longish for term vim and Emacs.) Adding to it for the other commenter…

There is another Python feature that saves you from this trap however - the nested function. I have lots of code that looks like this:

    def txform_item(x):
      
    # right below, for optimal locality of ref for human reader
    new_list = [ txform_item(item) for item in old_list ]

Re: Still in love with Rust

#144
post #22

Earlier quoted context omitted.

>big projects (my biggest project is 45k LoC) and it takes a couple of minutes to compile it I don't think 45k LoC could be considered big, and I _do_ think a couple minutes compile time is a problem. I say that as a C++ programmer, a full recompile will easily get me out of the zone

Out of curiosity, not to argue: how much time it takes in C++ to compile 45k LoC?

~100k loc takes 40 secs with `make -j 4` on my laptop.

Re: Still in love with Rust

#145

Can someone familiar with both Rust and F# (or OCaml) type systems write few words about the expressiveness aspect of the language? What would I miss in Rust if coming from the F# background?

In the surface you can say yes or no (only looking at types and such). But summing all the features, F# is far more immediately productive.

I take rust after 2 years on F# (that I continue to use). I have like 2 months of Rust now. I still struggle to solve things that are "no-brainers" in F# or swift (mainly, because Rust is VERY strict about know statically all about the code, and VERY hard to build generic, dynamic code).

So, it will look less expresive, IMHO. I still ramping-up and start to get more a more of the rust style of programming, so the pain is reduce. With the additions for rust in the near future it will reduce it more, I hope.

Re: Still in love with Rust

#146
post #139

Earlier quoted context omitted.

Hmm, my original comment was not a "gotcha" it is the simple truth. Anyone trying to sell you a tool by claiming that "it will make you a good whatever" is just trying it on. Yes, a good tool can help achieve better results but that's not the same at all. Then, all the replies I received were seemingly defiant but all in fact agreed to the point while trying to sound smart.

The issue with your comment is the dismissive and reductionist point of view, this place isn't childish, it's exactly the opposite: people here don't tolerate so much statements of absoluteness or broken analogies.

This isn't dismissive nor reductionist. This is a simple fact of life. Perhaps experience is needed to grasp this, though, and to understand the analogy.

Childish, because I feel that some commenters see posting as a pissing contest.

I'm genuinely surprised by the reactions.

Re: Still in love with Rust

#147
post #10

> Rust will force you to be a good programmer, > [if] you like it or not. This is probably the best in-a-nutshell statement that describes what a good programming language is for me. I had similar moments in the past. Before Python I cared about indention to some degree. But once I got used to the way Python forces you to indent your code, I came to the realization that this is pretty much the way I should format my…

Only as good as Rust allows you to be, which is fine for some until they stagnate or grow out of it; but far from the final answer to anything. I don't get at all how being forced to do anything could ever be a good thing. Smells like cognitive dissonance from here. I'm all for powerful tools that enables me to write better code faster; but being forced, really? That's the best thing about Rust? Ew.

Have you ever heard about the new thing called static typing programming language? I heard it force people to put only data with correct type into a function, it doesn't allow me to put any memory address I want to, such bad thing. Ew.

Jokes aside, I see rust borrow checker is just another dimension of type checking, it is type checking for access behavior and that's all about it.

Just as you can wrap your data in memory into static type system and leverage it to make a class of mistake impossible (passing wrong data to a function), you can wrap your access behavior into lifetime type system (converting raw pointer access behavior to reference with correct lifetime/access using unsafe) and make a class of mistake impossible.

In my definition, that's a powerful tools that help me to write better code faster.

Re: Still in love with Rust

#148

> Barriers to entry So far I had two faltering attempts to learn Rust but somehow I didn't find good enough material to get me hooked. I am looking for something similar to the Tour of Go[1], where you can interactively try the language by solving minimal tasks. Does someone know of such material? [1]: https://tour.golang.org

I come from C. What got me started was the O'Reilly book, Programming Rust by Blandy & Orendorff. (It cultivates the your sense of snobbery too. Imagine code examples using lists of "murderous Renaissance artists".)

In fact, that was the book I started with once. I kept reading until page 76. The book isn't bad, but I think books are just not the best medium to learn new languages, at least for me.

Re: Still in love with Rust

#149

> Barriers to entry So far I had two faltering attempts to learn Rust but somehow I didn't find good enough material to get me hooked. I am looking for something similar to the Tour of Go[1], where you can interactively try the language by solving minimal tasks. Does someone know of such material? [1]: https://tour.golang.org

https://doc.rust-lang.org/rust-by-example/

That looks pretty good. Thanks :-)

Re: Still in love with Rust

#150
post #10

> Rust will force you to be a good programmer, > [if] you like it or not. This is probably the best in-a-nutshell statement that describes what a good programming language is for me. I had similar moments in the past. Before Python I cared about indention to some degree. But once I got used to the way Python forces you to indent your code, I came to the realization that this is pretty much the way I should format my…

Python formatting is egregious though, with hopelessly long lines and no sign of where to break them up, or at the most weird places. Yes I'm one of those persons who adheres to the terminal 80 column rule, it's neat for splitting and cascades into many benefits. Python often looks like unkempt code to me, like the developer has no care for how it looks or layouts (which isn't true, it's Python's fault.) The forced i…

[deleted]
Post reply on HN