You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 22, 2021. It is now read-only.
Currently, if a user takes as parameter a List[Int] and get a View from it, there is no automatic way to get back a List, unless the user explicitly mentions the companion object: xsView.to(List). I wish we could just write xs.force(), so that if we change the type of the underlying collection to be a Vector we don’t have to repeat the change when calling .to(Vector).
#144 Provides a solution to this problem by introducing the concept of view transformers. However it only works with unsorted collection types and with collection type constructors of kind * -> *. We should investigate the ability to also support sorted collections and other kinds.
The text was updated successfully, but these errors were encountered:
IMHO this is unnecessary. Do you ever care about getting the same type as the source collection back without knowing what it was? Either you know what you start with or you know what you want to build no matter what.
(If we should end up doing this #543 needs to be reopened and fixed properly)
@szeiger - Very often the choice of collection is made for performance reasons. Having it be maintained without knowing what it was is usually the performance-friendly option; eager operations on Seq have this property. Losing this property for views is okay, but it is a loss. (We already deal with this loss with Iterator, for instance.)
Losing this property for views is okay, but it is a loss
I take your point, but there is a sense in which it also a gain, because it is simpler. No longer carrying this information makes it easier, overall, to understand what views are and how they behave.
@SethTisue - I agree. My point was only that it's a tradeoff. I don't have a strong opinion about which consideration is more important. Since it is work to make it remember the information, I would lean more towards "forget the underlying type".
Currently, if a user takes as parameter a
List[Int]
and get aView
from it, there is no automatic way to get back aList
, unless the user explicitly mentions the companion object:xsView.to(List)
. I wish we could just writexs.force()
, so that if we change the type of the underlying collection to be aVector
we don’t have to repeat the change when calling.to(Vector)
.#144 Provides a solution to this problem by introducing the concept of view transformers. However it only works with unsorted collection types and with collection type constructors of kind
* -> *
. We should investigate the ability to also support sorted collections and other kinds.The text was updated successfully, but these errors were encountered: