54 lines
2.2 KiB
Text
54 lines
2.2 KiB
Text
done:
|
|
- primitives
|
|
- structures: list, product, sum, ...
|
|
can compose structures, e.g., create list of list of product of sum of ...
|
|
set and dictionary implemented as purely functional red-black tree
|
|
keys allowed: (anything with total ordering)
|
|
- primitive values
|
|
- structural values
|
|
- dynamically typed values
|
|
- types
|
|
- generic types and type unification (inferencing)
|
|
- recursive types
|
|
- dynamic typing (value + type)
|
|
- projectional editor (hosted at https://deemz.org/public/dope2)
|
|
|
|
todo:
|
|
- simpler encoding of product/sum and struct/enum
|
|
want:
|
|
- easy to debug (current solution of deeply nesting sums/products results in hard-to-read values)
|
|
- not crazy inefficient (current solution requires N 'jumps' for the N-th field)
|
|
- bonus: should "mix well" with React so the React state can be typed by DOPE.
|
|
array-based:
|
|
struct {x:42, y:true, z:"hey"} becomes [42, true, "hey"]
|
|
enum {kind: "product", val: {price: 100}} becomes ["product", 100]
|
|
assessment:
|
|
(+) we don't need the keys in our encoding (they are redundant if we know the type)
|
|
(-) lack of keys is slightly harder to debug
|
|
(--) very big objects (e.g., our web application state) become a single array, which is very inefficient to update (no reuse)
|
|
=> OFF THE TABLE
|
|
slight variation:
|
|
- still use arrays for structs
|
|
- natively support N-ary product/sum
|
|
-> easy to implement
|
|
-> easy to debug
|
|
- no flattening
|
|
|
|
|
|
- mutually recursive types
|
|
|
|
- turn AST type for lambda calculus expressions from projectional editor into explicit DOPE type
|
|
|
|
- to support sets of slots, need comparison of slots
|
|
=> comparison of values
|
|
=> problem: how to compare transformed values? their inputs can come from different types
|
|
|
|
(a) tedious: put in every value:
|
|
- the type
|
|
- a comparison function for that type
|
|
then first compare types, if types match, compare values.
|
|
could generalize this by writing a compare function on 'typed' values.
|
|
|
|
(b) dirty: use 'magic' function that compares any JS value
|
|
|
|
- interfaces (type classes)
|