share/ottypes — pull request #15 by dmitryuv (2014-04-25 16:24:24+00:00)
Title: optional insert operation

Initial version of the "optional insert" operation. The best name I've found is "oin" which means Object Insert if Not Null.

The goal is to solve situation when both clients to start offline with empty doc and want to collaborate on subobject with known name. Without this operation, last client that syncs to the server will overwrite everything first client did.

Basic transform rules:
```
(oin, oin') -> oin'
(oin', oin) -> oin
(oin, oi) -> noop
(oi, oin) -> od, oi
```

Composition rules:
```
oi+oin -> oi
oin + oi -> od, oi
oin' + oin -> oin'
od + oin -> od, oi
```

Inversion:
```
invert(oin) -> od
```

The operation will be deterministic only with sane usage (including invert rule). For example, everyone should try to init document with the same initial value. Everyone should not try to shot operation if he knows for sure that object exists.