On Sat, Feb 1, 2014 at 6:31 PM, Corey Richardson <co...@octayn.net> wrote: > On Sat, Feb 1, 2014 at 6:24 PM, Eric Reed <ecr...@cs.washington.edu> wrote: >> Again, I strongly disagree here. >> There IS only one function foo. Some of it's arguments are types. foo's >> behavior *does not change* based on the type parameters because of >> parametricity. >> That the compiler monomporphizes generic functions is just an implementation >> detail and doesn't change the semantics of the function. >> > > It can if it uses Any, size_of, etc. eddyb had "integers in the > typesystem" by using size_of and [u8, ..N]. Anything using the > "properties" of types or the tydescs *will* change for each > instantiation. >
Furthermore, I don't considered monomorphic instantiation to be an implementation detail. Without it the difference between trait objects and generics is nonsensical, and iirc there's code that depends on the addresses of different instantiations being different (though I might be confusing that with statics). It's also important to understanding the performance characteristics of Rust, esp binary size and why metadata is so huge. It's a vital detail to understanding Rust, and any use of it needs to consider it. If it is indeed considered an implementation detail, it's probably the most important implementation detail I've seen in anything. Given Rust's target market, it'd be irresponsible to ignore it... _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev