I pushed the new kind system today. Things to be aware of are: - We now have proper copyability analysis, and resources can be used in saner ways.
- The way arguments are passed to tag, object, and resource constructors changed. See my other e-mail to the list. - 'Last uses' of locals (arguments passed in a mode that makes them owned by the function, and local let variables) are now treated specially -- when stored or passed somewhere, they are moved instead of copied. Most importantly, this makes most returning a local or putting it in a data structure more efficient. This is taken into account by the copyability analysis, so that you only get an error when your program actually tries to use a noncopyable local after storing it somewhere. - The kinds are now called 'sendable', 'copyable', and 'noncopyable'. The keywords to mark generic parameters are 'send' and 'copy' (noncopyable is what you get when you don't specify a keyword). - I got rid of the 'implicit shared [copyable] kind for generic functions' thing again. This means you'll once again often forget to add 'copy' and have to add it after the compiler complains. About 40% of the generic functions in our standard library require copyable arguments -- this is more than I expected. Still, over half can operate on noncopyable types. Defaulting to copyable would have an effect similar to the 'const' keyword in C++ -- people forget to think about it when they write generic functions, so when you do need to apply a generic to a noncopyable kind, you'll first have to fix the generic and all generics it calls to have the right kind bound. - Warning about copying of unique types is easy now (it's implemented and commented out at https://github.com/graydon/rust/blob/master/src/comp/middle/kind.rs#L127 ), but it generates an enormous amount of warnings because we're copying vectors everywhere. I think we might as well leave this off until we have non-unique vector types. That's it. I'll write something up in the tutorial early next week. I think the new system is easier to think about and to explain. And the last-use analysis provided a nice speedup by saving us a bunch of copies. Best, Marijn _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev