tonsky/datascript

Symbols are not allowed as constants

zoren opened this issue · 1 comments

zoren commented

With Datomic this query parses and returns #{[1]}:

(q
    '[:where [?e :s plain]
      :find ?e]
    '[[1 :s plain]])

treating plain as a constant. This fits with Datomics documentation that defines a constant as "any non-variable data literal". Datascript fails to parse the query as it doesn't recognise the data pattern.

Note that source variables(those that start with $) not in first position are also treated as constants so the following also parses and runs in Datomic

(q
    '[:where [?e :s $plain]
      :find ?e]
    '[[1 :s $plain]])

I expected Datascript to return the same result as Datomic in this case.

I have a minor update to the parser that fixes this and some tests I can contribute.

Please do! It will be a welcome addition