Interactions of d/basis-t, d/as-of, d/with

I was expecting for dbvals to have the same value semantics as Clojure data structures. This would mean I can have multiple timelines. In git parlance, “rewind and branch from past”. I understand that if the branch was pushed it would be a merge.

This does not work as I expected. My present understanding is: d/with will return a dbval with the most up-to-date d/basis-t which has been constrained by setting a d/as-of flag. So all dbvals will always have a basis-t of the highest t value known to the peer.

What is going on? Why is it implemented this way?

Here is a gist demonstrating the weird semantics

Thanks

I now understand that as-of is implemented as a filter, and the semantics of using d/with on a filtered dbval is not clear or perhaps meaningless. Though things are still a little murky to me as to the exact semantics and if branching from the past is a reasonable thing to want to do (given that it can never be transacted) and why it is the way it is and not like Clojure’s data structures.

It would be great if db/with on an as-of db threw an error. I just had a developer loose 2 days because of this issue. I doubt anyone has the intuition these semantics.

Agree, I had the same issue

https://docs.datomic.com/pro/time/filters.html#as-of-not-branch is very clear. Either I missed it or it was not there the first time I read the docs. it may help to put this bit in the as of api docs.

Datomic Cloud doesn’t have d/filter, so its docs lack the equivalent section, but since it does have d/with, I would still expect a mention of how we “can’t branch the past”.