|
| 1 | +# Open questions |
| 2 | + |
| 3 | +Please also include TODO in appropriate locations. This is intended as a wrap up. |
| 4 | + |
| 5 | +Also, include whether the question is to add or remove something, and add date/initials |
| 6 | + |
| 7 | +## NotNulWhen on TryGetValue in ValueSource and ValueProvider |
| 8 | + |
| 9 | +Things to consider: |
| 10 | + |
| 11 | +* Within System.CommandLine all TryGetValue should probably be the same |
| 12 | +* TryGetValue on dictionary can return null |
| 13 | +* For nullable values, the actual value can be null |
| 14 | +* For nullable or non-nullable ref types, the default for the type is null |
| 15 | +* Allowing null out values keeps a single meaning to "not found" and allows "found but null". Conflating these blocks expressing which happened |
| 16 | + |
| 17 | +The recovery is the same as with Dictionary.TryGetValue. The first line of the block that handles the return Boolean is a guard. |
| 18 | + |
| 19 | +## The extensibility story for ValueSource |
| 20 | + |
| 21 | +The proposal and current code seal our value sources and expect people to make additional ones based on ValueSource. The classes are public and sealed, the constructors are internal. |
| 22 | + |
| 23 | +Reasons to reconsider: Aggregate value source has a logical precedence or an as entered one. If someone adds a new value source, it is always last in the logic precedence.There are likely to be other similar cases. |
| 24 | + |
| 25 | +Possible resolution: Have this be case by case and allow aggregate values to be unsealed and have a mechanism for overriding. Providing a non-inheritance based solution could make this look like a normal operation when it is a rare one. |
| 26 | + |
| 27 | +## Contexts [RESOLVED] |
| 28 | + |
| 29 | +We had two different philosophies at different spots in subsystems. "Give folks everything they might need" and "Give folks only what we know they need". |
| 30 | + |
| 31 | +The first probably means we pass around `PipelineResult`. The second means that each purpose needs a special context. Sharing contexts is likely to mean that something will be added to one context that is unneeded by the other. Known expected contexts are: |
| 32 | + |
| 33 | +- `AnnotationProviderContext` |
| 34 | +- `ValueSourceContext` |
| 35 | +- `ValidationContext` (includes ability to report diagnostics) |
| 36 | +- `CompletionContext` |
| 37 | +- `HelpContext` |
| 38 | + |
| 39 | +## Which contexts should allow diagnostic reporting? |
| 40 | + |
| 41 | +## Should we have both Validators and IValidator on Conditions? [RESOLVED] |
| 42 | + |
| 43 | +We started with `Validators` and then added the IValidator interface to allow conditions to do validation because they have the strong type. Checking for this first also avoids a dictionary lookup. |
| 44 | + |
| 45 | +Our default validations will be on the Condition for the shortcut. Users can offer alternatives by creaing custom validators. The dictionary for custom validators will be lazy, and lookups will be pay for play when the user has custom validators. (This is not yet implemented.) |
| 46 | + |
| 47 | +When present, custom validators have precedence. There is no cost when they are not present. |
| 48 | + |
| 49 | +## Should conditions be public |
| 50 | + |
| 51 | +Since there are factory methods and validators could still access them, current behavior could be supported with internal conditions. |
| 52 | + |
| 53 | +However, the point of conditions is that they are a statement about the symbol and not an implementation. They are known to be used by completions and completions are expected to be extended. Thus, to get the values held in the condition (such as environment variable name) need to be available outside the external scope. |
| 54 | + |
| 55 | +Suggestion: Use internal constructors and leave conditions public |
| 56 | + |
0 commit comments