This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
Constraint scripting "language" used through attribute compiling it #44
Labels
enhancement
New feature or request
Milestone
Credits
Suggested by @KoziLord
Feature Review
The feature would implement a way for the user to specify the constriants in a more natural way through a variation of C#'s syntax for generic constraints that would be parsed and compiled. Syntax errors will be reported as diagnostic errors within the string.
Syntax Error Reporting
The diagnostics reported for syntax errors within the scripting code will have to make use of a brand new rule prefix,
GAS
. This is so that it can follow the respective C# error rule ID system, without reporting actualCS
errors.Example
Here is an example of an early concept of the implemenation:
In that example, the
,
denotes an AND,;
denotes an OR, and parentheses work as better proioritizing the expression within them. AND has a higher priority than OR, meaning that the first line is a constraint, and the second line is another constraint, requiring that one of the two constraints be met.More specifically, the type argument must meet one of the following criteria in this case:
IEquatable<int>
,IEnumerable<string>
, and have anew()
constructor, ORIEquatable<long>
,IEnumerable<char>
Passes:
Fails:
API Design
TODO
The text was updated successfully, but these errors were encountered: