In the latest Rust upgrade for Servo, I noticed that the path API is
now mutate-in-place instead of return a new path. It used to be that
path.push("foo") gave you a new path with an extra component, but now
path.push("foo") returns () and mutates the path in place.

I liked the old API better. I realize this is probably more consistent
with std::vec, and consistency is good. I thought I'd bring this up to
see what other people thought as a lot of the APIs are getting
rewritten lately and I haven't seen any concrete guidelines on what
they should be.

If we decide that both API styles are good to have, what should the
naming convention be for the functional vs. mutable ones? Ruby,
Scheme, and Clojure use `!` to denote the in-place mutation ones, but
that syntax is for macros in rust.

jack.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to