On Fri, Oct 18, 2013 at 6:09 PM, Jack Moffitt <[email protected]> wrote:

> 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.
>

FWIW, the convention in many other APIs is that the return-modified-copy
versions use past participle. So e.g. the modify-in-place method would be
called `foo.frobulate()`, while the "functional" one would be called
`foo.frobulated()`. I think this is nice, but it can get a bit more
difficult with arguments. (If the mutating method is called
`foo.append(bar)`, what's the other one? `foo.appended(bar)`?
`foo.with_appended(bar)`? Something else?)

-- 
Your ship was destroyed in a monadic eruption.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to