scala icon indicating copy to clipboard operation
scala copied to clipboard

Drop covariance?

Open snowleopard opened this issue 7 years ago • 2 comments

As pointed by @mechkg, we can drop covariance and obtain a more type-safe interface as a result.

Do we want to keep covariance? I'm tempted to drop it both for the sake of simplification and for better type safety of the graph transformation interface.

As a comparison, List is covariant, whereas Set is not.

snowleopard avatar Nov 23 '17 11:11 snowleopard

It is an very interesting design choice to discuss upon and decide. I find no compelling reason for graph to be invariant although as you mentioned it can be done for simplification. Here Daniel's answer gives idea why set is invariant and this thread gives more insights about the design decision.

adithyaselv avatar Apr 15 '18 05:04 adithyaselv

@adithyaselv Thanks! Yes, after reading various discussions, including the ones you link, I guess we can live with slightly less elegant code for the sake of having covariance, which seems to be expected by default.

snowleopard avatar Apr 15 '18 10:04 snowleopard