The problem with modes was not that they were trying to push low-level decisions onto the developer.  In contrast, they were trying to hide low-level decisions, but they did an imperfect job.  As a result, it was particularly confusing when mismatches between things like ++, +, and && modes would arise.  I hope that by making pointers more explicit and clear, it should be less confusing when the compiler says "I expected a pointer here but I didn't get one" (or vice versa).

Another problem was that modes were not especially expressive.  You could not, for example, have a function that returned a pointer into the interior of a data structure.  As a result, we tended to write functions that took a closure to do all operations.  There are numerous related problems that arose: You could not move references values into a tuple or other structure, which hinders attempts to match over two types at once or to write generic wrappers for functions.  You could not bundle up repetitive sets of parameters into structures.  And so forth.

Rust does not have the goal of *hiding* low-level implementation details from the user; rather the opposite in fact.  But at the same time we *do* want to enable the construction of higher-level abstractions---and particularly ones that can be compiled to very efficient code.  Sometimes these goals conflict.  Sometimes they do not.  Modes ultimately worked against both of these goals.  Of course, Rust is a project with many authors, some of whom may have a different point of view.  But that is how I see things.


Niko

October 22, 2012 1:09 PM
I've got to admit, I am not very familiar with Rust's history, but from a brief skimming of what I could find on parameter modes, I got the impression that this feature was removed because it pushed too many low-level decisions onto the developer.

Would you mind pointing me towards the thread that discussed the problems with generics that you are referring to?

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

Reply via email to