On 7/22/12 11:31 AM, Masklinn wrote:
On 2012-07-22, at 20:18 , Patrick Walton wrote:
That said personally I think there is no point having properties and
prop functions unless  you can have "private"  fields which im not sure
Rust can do as you need a "this" pointer which then makes you an OO
language .

Classes (now structs) do have private fields. Methods have an implicit (soon to be 
explicit) "this" pointer.


But do they have public fields, and if so why?

They do, to achieve the FP separation of code and data. Max/min classes have very little magic; they're pretty much just newtyped records.

Now as I noted above, I do not know if Rust has public fields. If it
does, I think that's a mistake especially if the compiler is smart
enough to inline "accessor methods", but in that case the discussion
needs to happen now, it *will* be held against the language down the
line.

I'm not sure. Is it a mistake in, say, Haskell or ML?

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to