The issue is that we need to compile the map of GlobalSimpleTypeFactories, as that is the data structure that the compiler uses whenever it needs to look up a type by qname.
I suppose we could change the type of that data structure from (guessing at what the original structure looks like) Map[QName, GlobalSimpleTypeFactory] tp Map[QName, => GlobalSimpleTypeFactory], which probably will do what we want, but we are then relying on lazyness for our program to be correct, which always makes me a bit nervous. The only thing this gets us is the ability to compile broken schema so long as the broken part is not being used. Apart from backwards compatibility concerns, I am not sure we are doing anyone any favors by allowing this. ________________________________ From: Beckerle, Mike <[email protected]> Sent: Friday, April 5, 2019 5:59:12 PM To: [email protected] Subject: Re: Exposing latent SDEs Do we have to compile simple types even if unused? Cant we compile them lazily if used. I am very happy to restrict expressions that use simple type qnames for them to have to be literal constants. Then compiling the expressions would provide the qnames of the types actually being used. Get Outlook for Android<https://aka.ms/ghei36> ________________________________ From: Sloane, Brandon <[email protected]> Sent: Friday, April 5, 2019 5:12:26 PM To: [email protected] Subject: Exposing latent SDEs This is related to the previous thread with the subject "Further design difficulties with TypeValueCalculators". I believe I have solved the main issue of that thread by computing attributes that do not depend on the context in the SimpleTypeDefFactory instead of the instance class [0]. However, there is still an issue where I am changing the behaviour of Daffodil to compile aspects simpleTypes regardless of if they are used or not. We avoid the previous problem by making these aspects only those whose correctness does not depend on the local context. However, there is still an issue where if an unused simpleType is just plain broken, it will now emit an SDE. For instance, in section05/facets/Facets.tdml we have the following schema: 4856 <xs:simpleType name="enum_st1"> 4857 <xs:restriction base="xs:string"> 4858 <xs:enumeration value="Trout" /> 4859 <xs:enumeration value="Bass" /> 4860 <xs:enumeration value="Catfish" /> 4861 </xs:restriction> 4862 </xs:simpleType> 4880 <xs:simpleType name="enum_st4"> 4881 <xs:restriction base="ex:enum_st1"> 4882 <xs:enumeration value="Trout" /> 4883 <xs:enumeration value="Bass" /> 4884 <xs:enumeration value="Carp" /> 4885 </xs:restriction> 4886 </xs:simpleType> As test case facetEnum06 verifies, enum_st4 is broken because "Local enumerations must be a subset of base enumerations" The issue I am now running into is that all tests that use that schema are now failing due to this, even if they do not actually use enum_st4. Abstractly, I don't mind calling this acceptable behaviour, as there is an SDE in any schema containing enum_st4, even if the original implementation ignored it; and I don't mind updating the relevent test files to isolate these broken types in their own schema, but I wanted to verify that it is okay to make this sort of backwards incompatible change. [0] This involved a fair amount of refactoring. There is more refactoring that can be done along these lines (which I believe will help with our performance issue), but I only did what was needed to support the functionality I am adding. Regards, Brandon T. Sloane Associate, Services [email protected] | tresys.com
