[YANGTOOLS-1114] Reconsider DefaultEffectiveStatement definition Created: 23/Jun/20 Updated: 05/Jan/24 |
|
| Status: | Confirmed |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 14.0.0 |
| Type: | Improvement | Priority: | High |
| Reporter: | Robert Varga | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Our current definition of DefaultEffectiveStatement (and declared statement by extension) requires users to manually parse the value to correlate it to the actual value. What we really would like to say is that both these have a bound value, which is bound the parent type – i.e. the bracket is EffectiveStatement<Object>, specialized to Uint16 for uint16 types. Since we are required to parse the argument when a statement is defined, this needs some more thought as to the inference mechanics – i.e. before we can successfully create the statement we need to have its parent statement perform type inference to resolve the base type. |
| Comments |
| Comment by Robert Varga [ 27/Oct/21 ] |
|
DataNodeIdentifier is our candidate for yang.common's representation of YANG's instance-identifier type. |
| Comment by Robert Varga [ 27/Oct/21 ] |
|
RFC7950 defines four places where a 'default' statement can occur, which boil down to two distinct kinds:
The value domain part a bit thorny where 'instance-identifier', 'leafref' and 'identityref' type are concerned, as they differ in how namespaces are bound. In both cases qualified qnames are bound at the declaration site, but then unqualified qnames are
We need to consider all of these in this design. I think we can expend some memory in making an indirection, i.e. to have a DefaultArg interface and that providing access to values. I think it is fair for parser implementation to provide QualifedBound values for leaf/leaf-list, just as is the case with XPath expressions. Users usually have the means to understand the default namespace at the instantiation site. |
| Comment by Robert Varga [ 27/Oct/21 ] |
|
The other part is that we need to understand how the type system is wired before we call DefaultStatementSupport.parseArgument(), simply because we want immutable classes and in order to correctly interpret the incoming string we need to know in what domain it resides. This implies that all statements which could potentially be holding back a default statement must be present in a previous phase – and must gate its finalization of that previous phase with inference actions, so that when that previous phase completes, 'default's parent has either a populated namespace, or can reconstruct that information on demand (for example via a vritual namespace?). |