I have begun attempted to write schema to take advantage of the recent Enum feature. In doing so, I have encountered 2 quality of life issues:
1) Errors that ought to occur at compile time are defered to runtime. I discussed this at https://issues.apache.org/jira/projects/DAFFODIL/issues/DAFFODIL-2148 (which I closed as wont fix). The main issue here is that providing all of the typeCalcs to the expression compiler introduces a circular dependency that seems difficult to resolve. This means that if the type specified does not exist or is not valid, we cannot detect that at compile time. 2) Unsiged types are not a subtype of their signed counterpart (this is inherited from XSD). This means that if we define a typeCalc type that is f : xs:int -> xs:string, and attempt to run it on a value of xs:unsignedInt, we receive an RSDE because xs:unsignedInt is not a subtype of xs:int. Normally, we would handle this situation by having the compiler insert an explicit cast. However, due to (1), we do not know the type of f until runtime, so cannot insert the cast at compile time. (Also, f could, in principle, be specified by a computed value, instead of a hard-coded string; although I cannot think of a case where you would want to do that). At the moment, the above situtation results in an RSDE that looks like: Runtime Schema Definition Error: The type calculator defined by tns:dfi3007_headerTypeType_1EnumTable has a source type of Int, but its usage requires UnsignedInt Unless any one has a better idea for dealing with this, I am planning on leaving this issue as is. In such a cirumstance, the user will need to either change the repType of the type calculator to have the required primitive type, or add in the cast manually. In the case were the required type is actually a subtype of the source type, the runtime can still handle it appropriatly. Brandon T. Sloane Associate, Services [email protected] | tresys.com
