Академический Документы
Профессиональный Документы
Культура Документы
Rich Hickey
Provocation
! Single-dispatch, stateful OO
! MI/Mixins/Interfaces
! Static/Dynamic typing
! Semicolons/indentation/blocks
! Closures/Inner-classes
! Are we just going to tweak this model for the next few
decades?
! Just admit the possibility that not only are we not there, we
may be driving on the wrong road.
What are we
missing?
! Incidental complexity
! Time/Process
! Functions/Value/Identity/State
! Action/Perception
“Seek simplicity, and distrust it.”
! Surface syntax
! Expressivity
! Perception is fragile
“No man can cross the same river
twice.”
Heraclitus
Oops!
! Caching
! Perceived
! Remembered
! Discretization
! Simultaneity detection
F F F
v1 v2 v3 v4
States
Identity (immutable values)
(succession of states)
Observers/perception/memory
Implementation ideas
! We need language constructs ! We can (must?) consume
that will let us efficiently: memory to model time!
! Represent values. Create and ! Old value -> pure function ->
share. new value
0 1 2 3 4
F F F
v1 v2 v3 v4
States
Identity (immutable values)
(succession of states)
Observers/perception/memory
Time constructs
vN vN+1 F F
vNs v2 v3 v4
AtomicReference
vN vN+1
! send(aRef, f, args)
vNs
! returns immediately
v1 v2 v3 v4
v1 v2 v3 v4
v1 v2 v3 v4
Transactions F F F F
F F F F F
F F F
Perception in (MVCC) STM
v2 v3 v2 v3
Transactional
snapshots
v2 v3 v2 v3
v2 v3
Non-transactional
scans
v2 v3
Multiversion concurrency control
! No interference with processes ! Allows observers/readers to
have timeline
! Models light propagation,
sensory system delay ! Composite snapshots are like
visual glimpses, from a
! By keeping some history point-in-time in the
transaction universe
! Persistent data structures
make history cheap ! Free reads are like visual
scans that span time
STMs differ
! limited to scans
! Granularity matters!