Live data from Hacker News

My favorite Rust function

blog.jabid.in

181–190 of 197 posts

Re: My favorite Rust function

#181

Earlier quoted context omitted.

> Enumerations - those are integers not enumerations. In Golang they have a type Bool which is either true or false. Can I define my own type using the same convention in GoLang? No. I can't. Ideally I want the ability to do this: type Bool = Enum { True False } or type Tri = Enum { True False QuantumTrueFalseDuality } But in Golang I'm locked in with what the creators provided as primitive types. I can't go deeper.…

Those above are not integers but type that you have to explicitly cast integers to if you really want. Please don't make uninformed comments.

I don’t understand what you are referring too. Why don’t you clarify, then we’ll see who is truly uninformed. I readily cop to my mistakes and errors. Will you?

Re: My favorite Rust function

#182

Earlier quoted context omitted.

In my anecdotal experience, the type of programmers that evangelize and talk shit about programming languages tend to be on the less informed side of the knowledge spectrum.

I occasionally program Go because it has an amazing amount of libraries - I basically use it for random microservice type things that glue systems together. (Most recently, an HTTP login endpoint that sends and receives XMPP messages to authenticate the user.) I don't like it. I program Rust the rest of the time. I'm considering learning Perl5 so that at least my type system lets me do vaguely expressive things - I'm…

"unacceptably crippled" is a pejorative meant to insult, not a descriptive criticism.

Re: My favorite Rust function

#183
post #179

Earlier quoted context omitted.

> > or making the language unacceptably crippled like Go > ... if the only takeaway from Go for you is that it is “unacceptably crippled” then I feel you have missed a lot of insight. Perhaps the author used a poor choice of words and instead could have phrased their intent along the lines of: Go lacks the semantic density needed to express solutions in both a concise and consistent manner. Were this the case, it wou…

> Go lacks the semantic density needed to express solutions in both a concise and consistent manner. That is a difficult statement for a Go user to parse. It is referring to a lack of language features that result in verbosity or boilerplate?

There's a lack of language features that result in verbosity, boilerplate, less performance and/or less type safety.

Re: My favorite Rust function

#184

Earlier quoted context omitted.

> > or making the language unacceptably crippled like Go > ... if the only takeaway from Go for you is that it is “unacceptably crippled” then I feel you have missed a lot of insight. Perhaps the author used a poor choice of words and instead could have phrased their intent along the lines of: Go lacks the semantic density needed to express solutions in both a concise and consistent manner. Were this the case, it wou…

I think it's a syntax problem. ASCII doesn't have enough bracket characters to simply & clearly represent necessary language features. So it's harder for an intelligent human to sort and categorize these aspects. Pre-generics Java is about the appropriate amount of language complexity for our current lingua franca

Err, we had 10x times the features of "Pre-generics Java" even in 1970s Lisp and Smalltalk...

Re: My favorite Rust function

#185

Earlier quoted context omitted.

It is perfect fine to take by value something that is not Copy to transfer its ownership. It is a compiler error to use the value after it was moved. And the compiler error is quite explicit about how to solve it For example you can explicitly clone let y = add(x.clone()); let z = add(x);

What would be cases where the add() function need ownership of the x? What the chance in real life that a function like that cannot simply use a reference? In my learning Rust, my life became significantly better and easier when I started to references to borrow as much as possible.

That was just an example. But maybe 'x' is a BigInt type that use a memory allocation to store its contents. The ownership would be transferred to the return value

Re: My favorite Rust function

#186
post #41

Earlier quoted context omitted.

NLL does not change those semantics; drop still runs at the end of the scope. It counts as a "use" for the purposes of NLL and thus keeps values with destructors alive.

For some history, it was talked about changing this, but we couldn’t, due to back compatibility and it wasn’t clear it was actually a good idea. This was called “wary drop”.

“Early drop”, thanks autocorrect.

Re: My favorite Rust function

#187

Earlier quoted context omitted.

What would be cases where the add() function need ownership of the x? What the chance in real life that a function like that cannot simply use a reference? In my learning Rust, my life became significantly better and easier when I started to references to borrow as much as possible.

That was just an example. But maybe 'x' is a BigInt type that use a memory allocation to store its contents. The ownership would be transferred to the return value

But again, what would be the drawback(s) of using a pointer instead of transfering the ownership?

Not rethorical, I'm genuinely curious as I used to struggle with the copy vs move decisions, and a bunch of issues with ownership which went all away when I started using pointer/borrowing everywhere.

Re: My favorite Rust function

#188

Earlier quoted context omitted.

I think it's a syntax problem. ASCII doesn't have enough bracket characters to simply & clearly represent necessary language features. So it's harder for an intelligent human to sort and categorize these aspects. Pre-generics Java is about the appropriate amount of language complexity for our current lingua franca

I will gladly trade a little bit more language complexity if it means the complexity of the code that I write using that language is simpler.

This. When a platform refuses to solve a problem, that problem doesn't go away. The users are forced to roll their own solutions, none of which have the same test coverage and optimization opportunities.

Re: My favorite Rust function

#189

Earlier quoted context omitted.

I occasionally program Go because it has an amazing amount of libraries - I basically use it for random microservice type things that glue systems together. (Most recently, an HTTP login endpoint that sends and receives XMPP messages to authenticate the user.) I don't like it. I program Rust the rest of the time. I'm considering learning Perl5 so that at least my type system lets me do vaguely expressive things - I'm…

"unacceptably crippled" is a pejorative meant to insult, not a descriptive criticism.

[deleted]

Re: My favorite Rust function

#190
post #22

> or making the language unacceptably crippled like Go Gotta say, I lost a lot of respect for the author at this point. It’s not like I don’t love Rust - quite the contrary - but if the only takeaway from Go for you is that it is “unacceptably crippled” then I feel you have missed a lot of insight. Go has been one of my languages of choice for over half a decade now, and for good reason.

It may be an unnecessary dig, but the author may indeed be familiar with Go and still think it's unacceptably crippled for all their use cases. The whole post is just their opinion.

Using the word "crippled" is not in keeping with the Rust Code of Conduct. https://www.rust-lang.org/policies/code-of-conduct

Hey @dang -- why do you and Hacker News think it's ok to make comments at the expense of the differently-abled, and when I call you on it, the post gets flagged? That's NOT OK.

Post reply on HN