mozilla/mentat

[tx] Accept [a v] notation for lookup refs in entity position

Open

#392 aberto em 28 de mar. de 2017

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)Rust (116 forks)github user discovery
A-transactenhancementgood first bughelp wantedhygieneready

Métricas do repositório

Stars
 (1.661 stars)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

This is follow-up tracking https://github.com/mozilla/mentat/pull/382#pullrequestreview-28255925. In #382, I accept only (lookup-ref a v) for lookup-refs in both entity and value position (e and v in a [:db/add e _ v] assertion). That's contrary to Datomic, which accepts embedded vectors like [a v] in both locations, treating ambiguity in some ad-hoc way. (See the discussion in #183 for notes on this ambiguity.)

This ticket tracks accepting an embedded vector [a v] in the entity position only. We suspect that the majority of lookup refs are entity refs in this form, and it's both shorter to type and handy to agree with Datomic.

To implement this, you'll need to:

  1. verify that entid_or_lookup_ref_or_temp_id is still used only to parse entity positions;
  2. add a vector_lookup_ref function accepting [a v] around https://github.com/mozilla/mentat/blob/8adb6d97fd55b262d7d89708db86eb37f0e5ab0d/tx-parser/src/lib.rs#L72;
  3. use your new function around https://github.com/mozilla/mentat/blob/8adb6d97fd55b262d7d89708db86eb37f0e5ab0d/tx-parser/src/lib.rs#L88;
  4. add tests demonstrating you can used nested vectors in entity position and that you can use nested vectors in value position -- but they're not interpreted as lookup refs. This latter may already be tested by the existing tests!

Guia do colaborador