Scopes #5281
vpetrovykh
started this conversation in
Team Posts
Scopes
#5281
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The current state of understanding of scope:
DETACHEDcompletely ignores all current scope. Only schema-level symbols are recognized and it is equivalent to declaring a schema-level view.Explicit
SELECTmakes whatever it wraps into aSET OF. Other than that normal nested scope rules apply.Aliases created by
:=always imply an explicitSELECTfor their expression part, but they do define a new symbolic name for the resulting set behaves as any other named set from this point in the scope and in any nested scopes. The same reasoning that forbidsFILTERto alter the meaning of a path used inSELECT, also applies to aliases. Once defined they become opaque and cannot be filtered or otherwise affected by symbols referring to their components. The difference is that it's not illegal, but the aliased sets are no longer related to their components anywhere where the aliases are visible.Problems we're avoiding:
Lexical substitution is great when it's pure and without special cases. Unfortunately even simple aliasing can wreak havok on "just substitution: approach:
Also aliasing literals is all but useless under "pure substitution":
So we know we cannot "just substitute".
Non obvious interference from other parts of an expression:
Depending on the "substitution" and "implicit SELECT" doctrine there are really subtle differences in how the above expressions are treated.
Beta Was this translation helpful? Give feedback.
All reactions