stevedlawrence commented on code in PR #1241:
URL: https://github.com/apache/daffodil/pull/1241#discussion_r1605450428
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/Term.scala:
##########
@@ -527,7 +527,7 @@ trait Term
e.complexType.group.canUnparseIfHidden
Review Comment:
> I just want to know why the choice case uses the "exists" function?
With a sequence, we must be able to unparse all hidden children. But with a
choice, we don't care if there are some branches that can't be unparsed if the
choice is hidden--we just need to be able to unparse at least one branch. At
this point in the code we don't really care which that branch that is or if
there are multiple, we just need to know that such a branch exists. Later we
figure out which one we'll actually unparse with if the choice is hidden.
> but what if there are two group members which can be unparsed while hidden
(ambiguity),
Daffodil is supposed to just pick the first branch that can be fully
unparsed when hidden. There is actually a bug (DAFFODIL-2324) where we
incorrectly pick the "more empty" one even if it's not first. But regardles,
the answer to the question is w just pick one. I think during compilation we
will output a warning so the users know how we are disambiguating.
> or any group member selected by the choice dispatch key field
choiceDispatchKey/Branch is only used during parsing. In theory we could use
choiceDispatchKey to disambiguate, but not all choices use choice dispatch, the
dispatched branch might not be unparsable when hidden, or the dispatch
expression might depend on elements that are hidden. So there's lots of edge
cases to consider. It's simplest to just always ignore it when unparsing and
use the same logic whether choiceDispatch could work or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]