OpenGridForum / DFDL

10 stars 1 forks source link

Unparser forward reference variables #22

Open smhdfdl opened 3 years ago

smhdfdl commented 3 years ago

Scenario in the PCAP schema that uses several dfdl:outputValueCalc. To simplify the expressions, would like to use a variable with a value set by dfdl:newVariableInstance. The problem is that the rules for variables are different from those for dfdl:outputValueCalc, specifically variables can not refer forwards (because they are evaluated on both parse and unparse) whereas that is the point of dfdl:outputValueCalc. To ease this would require a change to the spec. Candidate for 2.0. Daffodil to implement as as an experimental feature.

smhdfdl commented 3 years ago

@mbeckerle Will the team be writing this up as an experience document?

mbeckerle commented 3 years ago

I think there is, or was, an experience document planned about the whole computed/calculated values feature set, about which there was some uncertainty that we had it all coherently specified.

This issue is the last in that suite of issues. It's all working. The draft that we need to turn into an experience doc is on the Daffodil wiki here: https://s.apache.org/daffodil-experience-with-computed-elements.

There is a section there about dfdl:newVariableInstance with forward reference, but it doesn't mention the direction="parse/unparse/both" attribute we're suggesting is needed on dfdl:defineVariable to make dfdl:newVariableInstance work properly, and the example needs to be better.