mozilla/mentat

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

Open

#392 创建于 2017年3月28日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)Rust (116 fork)github user discovery
A-transactenhancementgood first bughelp wantedhygieneready

仓库指标

Star
 (1,661 star)
PR 合并指标
 (PR 指标待抓取)

描述

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!

贡献者指南