-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbol Token and Symbol Table #11
Comments
Why is 'version' needed in 'ImportSource'? |
Since 'LocalSid' is present in 'SymbolToken', it must be used as a caching mechanism within a particular local symbol table context. What is the mechanism for guaranteeing that 'LocalSid' does not leak into a different context? |
You are right we don't need this here. |
I am a little confused about the question. I do believe the That said, are you saying this should not be modeled or are you asking about a constraint that should exist elsewhere (or enforced by the data structure)? |
Let's first agree that LocalSID, from a correctness perspective, is not necessary. That's because
If we agree on that, then we can agree that LocalSID may be used to cache the calculations referred to in 1. and 2. above. This is great when the SymbolToken is always used in compatible symbol table contexts because it reduces repetitive recalculation of the local SID in that context. However, SymbolTokens are often exposed via the public API. The reader may return a SymbolToken to the user, and that user subsequently may provide it to a writer that may have a completely different symbol table context than the reader that originally created the SymbolToken. If the writer were to use the LocalSID stored in the SymbolToken, the result is likely to be incorrect. My question is: how to we prevent misuse of LocalSID? Do we clear it before returning SymbolTokens via public APIs? Do we somehow make a SymbolToken aware of its context to make sure localSID is only used within the same context? We currently don't have a good story for this in ion-java. It would be great to start out on the right foot with ion-go to avoid repeating some of the same potential pitfalls. |
Misuse aside, let us consider the case where I want an unmanaged parser (one that does not do resolution of symbols), having the LocalSID with unknown text and unknown location would be the only way to model this if I wanted to ever expose such a reader (like we do in Python). Do you think the misuse issue obviates the unmanaged parser case? |
Having had an offline chat with @tgregg, here is where I think we're at with respect to local SID:
This, of course, implies we model unknown and undefined values for the field domains above. @tgregg, please feel free to add or correct anything I might've missed from our conversation. |
Removes non-used `symbols.go` module which had a preliminary symbol table implementation. Adds SymbolToken as a pure data structure. Adds SymbolTable as an abstract data type for system/shared/local symbol tables. None of the APIs are currently exported for making symbol tables. Resolves amazon-ion#11
Removes non-used `symbols.go` module which had a preliminary symbol table implementation. Adds SymbolToken as a pure data structure. Adds SymbolTable as an abstract data type for system/shared/local symbol tables. None of the APIs are currently exported for making symbol tables. Resolves amazon-ion#11
Removes non-used `symbols.go` module which had a preliminary symbol table implementation. Adds SymbolToken as a pure data structure. Adds SymbolTable as an abstract data type for system/shared/local symbol tables. None of the APIs are currently exported for making symbol tables. Makes a `goimports -w` pass to clean up a few files. Resolves #11
Had a a whiteboard session with @pbcornell and @mrutter-amzn on 1/24/2020 with some consensus on how to model
SymbolToken
andImportSource
:The variants of local/system/shared symbol table are closed so we should consider implementing this through a
struct
rather than ainterface
type.One thing that came out of this discussion that we should consider in implementing this is putting this into a
symbols
package and renaming the above APIs accordingly.The text was updated successfully, but these errors were encountered: