Live data from Hacker News

Announcing Rust 1.20

blog.rust-lang.org

1–10 of 277 posts

Re: Announcing Rust 1.20

#2
"Associated functions" = class methods

"Associated constants" = limited version of class variables

Rust keeps approaching C++'s feature set..

I am amazed that the above wasn't in Rust to begin with, though. Can't think of any other languages which has classes but no class methods/variables.

Re: Announcing Rust 1.20

#3
Interestingly, because Firefox chooses to use stable Rust exclusively, this is the version of Rust that will be used to deliver Quantum when Firefox 57 releases on November 14 (by which time Rust 1.21 will be out (releasing October 12), but Firefox 57 will be in beta by September 20).

Re: Announcing Rust 1.20

#4
post #2

"Associated functions" = class methods "Associated constants" = limited version of class variables Rust keeps approaching C++'s feature set.. I am amazed that the above wasn't in Rust to begin with, though. Can't think of any other languages which has classes but no class methods/variables.

Now you have me wondering what use a class is without methods or variables. It's just a namespace?

Re: Announcing Rust 1.20

#5
post #2

"Associated functions" = class methods "Associated constants" = limited version of class variables Rust keeps approaching C++'s feature set.. I am amazed that the above wasn't in Rust to begin with, though. Can't think of any other languages which has classes but no class methods/variables.

NB. associated functions have always existed.

Also, to be a little snide:

"Modules" = modules

"Concepts" = traits

C++ keeps approaching Rust's feature set!

It's normal and even expected that languages in a similar space will either draw inspiration from each other or converge on similar solutions.

Re: Announcing Rust 1.20

#6
post #2

"Associated functions" = class methods "Associated constants" = limited version of class variables Rust keeps approaching C++'s feature set.. I am amazed that the above wasn't in Rust to begin with, though. Can't think of any other languages which has classes but no class methods/variables.

You've misread the announcement; Rust has had associated functions since time immemorial. Associated consts aren't class variables, because constants can't vary (that's sort of the whole point of constants...). Rust also doesn't have classes in any recognizable sense (we can argue all day about whether Rust supports "OOP", but the separation of data and behavior into structs and impls respectively pretty thoroughly subsumes classes themselves).

Re: Announcing Rust 1.20

#7
post #2

"Associated functions" = class methods "Associated constants" = limited version of class variables Rust keeps approaching C++'s feature set.. I am amazed that the above wasn't in Rust to begin with, though. Can't think of any other languages which has classes but no class methods/variables.

I, at least, don't really think of Rust as having classes. Rusty design patterns don't really look like many traditional OOP design patterns. This is often a hurdle for new Rust programmers. Chapter 17 of the book (https://doc.rust-lang.org/book/second-edition/ch17-00-oop.ht...) is trying to grapple with this question.

Part of the difficulty here is nailing down what "class" even means, exactly. Rust doesn't fit into either of the three major schools of OOP, which I personally nickname the "smalltalk school", the "java school", or the "javascript school".

Re: Announcing Rust 1.20

#8
post #4
post #2

"Associated functions" = class methods "Associated constants" = limited version of class variables Rust keeps approaching C++'s feature set.. I am amazed that the above wasn't in Rust to begin with, though. Can't think of any other languages which has classes but no class methods/variables.

Now you have me wondering what use a class is without methods or variables. It's just a namespace?

"class methods" are specifically static methods, meaning they don't have a self/this object. Rust's closest equivalent to classes has always allowed normal methods and variables (as well as class/static methods, just not class/static "variables").

Re: Announcing Rust 1.20

#9
post #5
post #2

"Associated functions" = class methods "Associated constants" = limited version of class variables Rust keeps approaching C++'s feature set.. I am amazed that the above wasn't in Rust to begin with, though. Can't think of any other languages which has classes but no class methods/variables.

NB. associated functions have always existed. Also, to be a little snide: "Modules" = modules "Concepts" = traits C++ keeps approaching Rust's feature set! It's normal and even expected that languages in a similar space will either draw inspiration from each other or converge on similar solutions.

What's funny about this is that I had worded it even less clearly, and it was changed due to feedback: https://github.com/rust-lang/blog.rust-lang.org/pull/192#dis...

Guess I didn't go far enough :)

Re: Announcing Rust 1.20

#10
post #2

"Associated functions" = class methods "Associated constants" = limited version of class variables Rust keeps approaching C++'s feature set.. I am amazed that the above wasn't in Rust to begin with, though. Can't think of any other languages which has classes but no class methods/variables.

[deleted]
Post reply on HN