~/talk

HOW TO EXTEND MAP? ... OR WHY WE NEED COLLECTIONS REDESIGN?

Talkat Scalar Conference 2017 · 2017-04-07..04-08· [scala]
slides:none on file

Extending Scala's Map to a Grid (Map[(Int,Int),V] with row) breaks in practice because covariance and builders change return types: filter/map/flatMap use the collection builder so they return Map, not Grid. Fixes require implementing MapLike with adjusted type parameters, providing an implicit CanBuildFrom, and reimplementing withDefault variants; a subtle bug leaves empty inner maps (a memory leak). Practical advice is to prefer composition and minimal overrides rather than inheriting the full collections hierarchy.

AI-written summary · about

  1. 0:00Introduction
  2. 0:46The problem
  3. 2:29The collections
  4. 4:11Immutable map
  5. 6:49Interface
  6. 7:35Methods
  7. 11:07Code
  8. 12:12Testing
  9. 13:30Filter method
  10. 15:34Map method
  11. 18:17With default
  12. 19:17Recap
  13. 20:52Goals for new implementations
  14. 23:52Memory leak
  15. 26:39References
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.