On Sat, Feb 2, 2013 at 6:51 AM, Niko Matsakis <[email protected]> wrote:

>
>
> Niko Matsakis wrote:
>
> Basically what I'm getting at here is that both **freezable** and **
> persistent** maps share the property that they *act like immutable
> values*.  This is true **even though** freezable maps are modified
> in-place, because **at the time of modification** no aliases exist, so
> who's to say you didn't swap in a new map?
>
>
> Taking this idea a little further, you could almost just have one
> interface:
>

> [snip]
>
> As I wrote this, though, I realize the flaw: K and V would have to be
> declared copyable, which we do not want to require.
>


How big do we want to make the container interfaces? If we have a full
interface like Haskell:

http://www.haskell.org/ghc/docs/6.12.2/html/libraries/containers-0.3.0.0/Data-Map.html

Then we probably should just add a suffix to each form, like "_imm", since
I can't think up good names to distinguish all those functions from each
other. I do find that a bit ugly though.

On the other hand, if we wanted just a small interface like Scala, we could
probably get away with a coming up with names like insert/remove vs
plus/minus:

http://www.scala-lang.org/docu/files/collections-api/collections_10.html

Or we could just have two interfaces that share the same names, but have
different interfaces. I can't decide.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to