thatdot / quine

Quine • a streaming graph • https://quine.io • Discord: https://discord.gg/GMhd8TE4MR
https://quine.io
Other
295 stars 39 forks source link

Cypher: fix variables in scoped expressions #12

Closed harpocrates closed 2 years ago

harpocrates commented 2 years ago

Apparently, openCypher's freshening of variables does not extend to scoped expressions. We can fix this by manually "freshening" the variables in the expression subscopes.

The better solution would be to extend the scoping information maintained by the compiler to include a stack of scopes (when you enter a new scope you push and when you exit you pop). Unfortunately, that's not too helpful in Quine's case since the runtime still needs distinct column names (since it uses QueryContext ~ Map[Symbol, Value] instead of QueryContext ~ Vector[Value]). If the runtime representation of query contexts changed, the fix to this problem would be more in line with the usual compiler approach to scoping.