> Now that every parameter is passed by reference, our ABI is no longer > compatible with C.
Are you talking about calling C functions from rust, or calling rust from C? In the first case, we are generating a wrapper anyway, which currently makes sure things are passed by value. In the second case, you are right, but the C code can just pass pointers to things, and it'll work. I agree the current everything-by-reference situation is awful. I'm not keen on bringing back references though. One relatively simple solution would be partial monomorphizing: For each type parameter that a function takes, we generate one version for immediate (by value) types, and one version for structural types. You'd get 2^N (where N is the number of type params, rarely more than 2) version of each generic function. They can be generated in the crate that defines the function, so no involved cross-crate magic is needed yet. This'd make it predictable again whether an argument is passed by value or by reference, so the everything-by-reference hack can go again. It'd also make generic functions much more efficient when called on immediate values. What do you think? _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
