~/talk

Making sense of initialization order in Scala

Talkat Scalar 2016 · on Saturday, 2016-04-16· [scala]
slides:none on file

Demonstrates that Scala’s trait linearization and compiler-generated trait setters cause fields to be observed with default values or discarded values in surprising cases, with concrete examples that print zeros instead of expected constants; shows Dotty’s alternative where Dotty uses per-field init methods so fields can be final and better optimized; evaluates workarounds: lazy vals cost synchronization and can deadlock and early definitions can break assumptions; proposes forcing lazy-like init only during construction and reports Dotty experiments that exposed real code breakage.

AI-written summary · about

  1. 0:00Start
  2. 6:07TRICKY EXAMPLES
  3. 9:09SPECIFICATION: LINEARIZATION ORDER
  4. 22:28ALTERNATIVE: EARLY DEFINITIONS
  5. 25:06DOES NOT SOLVE THE PROBLEM OF ACCESSING PARTIALLY OR NOT INITIALIZED FIELDS
  6. 25:42A CRAZY IDEA
~/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.