3 ms·
I'm curious to know the reasoning behind removing the implicit self? Was their implementation having problems with it or was it rather a more deep-seated ideol
by octo_t 14y ago
I'm curious to know the reasoning behind removing the implicit self?
Was their implementation having problems with it or was it rather a more deep-seated ideological choice?
- metajack 14y agoA lot of the changes for 0.6 are removing keywords from the grammar. In this case, the `static` keyword has been removed, so there must be another way to tell if a method is static. Another reason might be so that self can be passed in a way the programmer prefers. Usually this appears to be `&self`, but it can also be passed in other ways. Disclaimer: I work for Mozilla on Servo, and am still getting fully up to speed on Rust.
- ksec 14y agooff topic: Any update on Servo? And its license? ( I hope its not MPL and instead Rust like MIT license and the Apache License )
- steveklabnik 14y agoThere's a ticket for that: https://github.com/mozilla/servo/issues/45 https://github.com/mozilla/servo/issues/45
- mcpherrinm 14y agoWhat apprehensions about the MPL do you have? It seems to me you can use MPL (2.0, at least) code in everything from GPL projects to proprietary software.
- felixmar 14y agoSmall correction: The static keyword has not been removed. It takes the place of the const keyword which has been removed.
- snprbob86 14y agoDisclaimer: I know practically nothing about Rust outside of observing from the HN side lines. Looking at the change log, it seems that they also removed the "static" keyword, so that class vs member methods are distinguished by the presence of a first argument named self. A little further down, they mention ~self, &self, and @self. Those prefixes differentiate types of special purpose pointers. So it seems the goal was not explicit self, so much as it was explicit pointer type annotations for self.
- the_mitsuhiko 14y ago> I'm curious to know the reasoning behind removing the implicit self? Less confusing for a user of when self is there and when it's not. Now it's always there and you don't have to know what the absence of self would indicate.
- pcwalton 14y agoThe old "self" was a reference type like C++—it behaved like a pointer but wasn't really a pointer (you didn't use * to access it). This was unneeded complexity in the language. It was also not obvious that the implicit self type was immutable. Finally, it let us remove "static" in a few places ("static" methods), reducing noise. It makes type implementations (impl Type { ... }) the same as regular modules, except that you can use "&self" and friends to declare methods.