beard-lang / design

0 stars 0 forks source link

Handling mutability #1

Open lmarcetic opened 8 years ago

lmarcetic commented 8 years ago

The DOM and the browser APIs are inherently mutable, so the language must have a way to deal with it.

Here are the three options discussed so far:

  1. Straightforward mutability - the worst option for determinism
  2. Monads - deprecated by myself due to the "mode" they impose on the program
  3. Effect handlers as described in http://arxiv.org/abs/1203.1539 - it is my new years resolution to read and understand this
eduardoleon commented 8 years ago

I'd go for straightforward mutability. I'm not sure 100% determinism is desirable or even possible in an interactive setting, and we need to think about how to do concurrency control right anyway.

lmarcetic commented 8 years ago

Determinism might be out of reach, but let us not surrender completely. More ideas:

  1. dataflow variables à la Oz - built up into streams (cf. self-messaging Erlang processes), these could make state transitions more explicit
  2. creating new objects instead of mutating old ones - not quite sure how this would work/look