Why no immutable indexed view?

32 views
Skip to first unread message

G J

unread,
Nov 20, 2012, 11:50:31 AM11/20/12
to scala...@googlegroups.com
Subject says it all...

The only indexed view is under collection.mutable.

I  wish to derive a class based on immutable indexed view, and could raise an exception for the update method to achieve that effect; but why...?

Thanks.

Best regards.

Simon Ochsenreither

unread,
Nov 20, 2012, 11:54:52 AM11/20/12
to scala...@googlegroups.com
I'm thinking something like an immutable array is sorely needed. Maybe it works for 2.11 ...

√iktor Ҡlang

unread,
Nov 20, 2012, 1:40:36 PM11/20/12
to Simon Ochsenreither, scala...@googlegroups.com

Vector?

G J

unread,
Nov 20, 2012, 1:53:23 PM11/20/12
to scala...@googlegroups.com, Simon Ochsenreither
Unfortunately, there are no views defined over Vectors.

Unless,  you were referring to Vector as an immutable Array then OK.

Best regards.

-----------------

Rex Kerr

unread,
Nov 20, 2012, 2:09:35 PM11/20/12
to G J, scala-user, Simon Ochsenreither
Well, Vector.view works.  But it produces something typed as Seq not IndexedSeq.  You need the efficient indexed slicing/dropping of IndexedSeq, I guess?  If not, there's not much reason to worry that it's typed "wrong".

G J

unread,
Nov 20, 2012, 2:25:18 PM11/20/12
to scala...@googlegroups.com
I missed the Vector.view function....; but, yes - I do want to make an assumption for the presence of efficient indexing in the immutable indexed view.

Best regards.
Reply all
Reply to author
Forward
0 new messages