Repository navigation
docs: describe the binder contract and how errors are reported - #39
Merged
Merged
Conversation
The XML comments left out how the expression builder uses a binder and how parsing and evaluation report errors: - Binder did not explain Context, or that an unqualified name is bound with a null type and isStatic set to true, in which case the binder can return an instance member of the context. - ContextAwareBinder and DefaultBinder did not say what they resolve: the members of the context, a predefined set of types, and the registered types, matched without regard to case. RegisterType did not say that a type is registered under its simple name, and the description of importAsStatic read as if instance members became static. - Parse did not say that its result describes the error, Evaluate did not mention the ArgumentException it throws for an invalid expression, and ExpressionBuilder.Visit mentioned ParseErrorException only for a stack that is too small. - ParseErrorException was described as a parsing error only, although it also reports errors found while building the expression tree. It also explains that Evaluate with an object context uses its runtime type, how Subparser differs from Parser, that Identifier holds operators as well as names, that MemberAccess covers members of types and methods in calls, that Unary covers conversions, and that a literal can be a character or null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The XML comments left out how the expression builder uses a binder and how parsing and evaluation report errors. This PR describes them:
Binderdid not explainContext, or that an unqualified name is bound with anulltype andisStaticset totrue, in which case the binder can return an instance member of the context.ContextAwareBinderandDefaultBinderdid not say what they resolve: the members of the context, a predefined set of types, and the registered types, matched without regard to case.RegisterTypedid not say that a type is registered under its simple name, and the description ofimportAsStaticread as if instance members became static.Parsedid not say that its result describes the error,Evaluatedid not mention theArgumentExceptionit throws for an invalid expression, andExpressionBuilder.VisitmentionedParseErrorExceptiononly for a stack that is too small.ParseErrorExceptionwas described as a parsing error only, although it also reports errors found while building the expression tree.It also explains that
Evaluatewith anobjectcontext uses its runtime type, howSubparserdiffers fromParser, thatIdentifierholds operators as well as names, thatMemberAccesscovers members of types and methods in calls, thatUnarycovers conversions, and that a literal can be a character ornull.Two behaviors are left undocumented because they need separate decisions:
RegisterTypesilently ignores a type whose simple name matches a predefined type, so the static members of aDateTimeorGuidcontext are not available without the type name, andEvaluate<TResult>converts the result with an unchecked explicit conversion, soEvaluate<byte>("300")returns44.Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com