This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1614 - please spell out all defaults explicitly
Summary: please spell out all defaults explicitly
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows 2000
: P2 normal
Target Milestone: ---
Assignee: Jerome Simeon
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-15 00:15 UTC by Fred Zemke
Modified: 2005-09-27 08:41 UTC (History)
0 users

See Also:


Attachments

Description Fred Zemke 2005-07-15 00:15:43 UTC
2.4 The [XPath/XQuery] type system
Since this is a purely formal language, not exposed to users, there
is no point in defining any defaults.  Instead, making every 
declaration totally explicit is to be preferred as the clearest.
By that principle, optionality should be used only for cases 
where missing syntax corresponds to a missing characteristic of
the defined type, rather than a defaulted characteristic.  
Adopting this principle would eliminate the need for the reader
to chase down the defaults (which is really hard to do in the 
current document, and I am not sure they are always there).  
Instead, the normalization and
type expansion rules should supply all defaults explicitly.
For example, the normalization rule for item() would be

  [item()]sequencetype 
  ==
  ( element of type xs:anyType | attribute | text | 
    document { ( text | element of type xs:anyType | comment 
                 | processing-instruction )* }
    | xdt:anyAtomicType )


In the case of attribute, the normalization rule in 3.5.4 
"SequenceType matching" currently is misleading, precisely
because it does not spell out the default.
One might think that the default type of an attribute node is
xs:anyType (on the strength of the statement in 2.4.4 "Top level 
definitions" that "When the type 
derivation is omitted, the type derives by restriction from 
xs:anyType...").  However, xs:anySimpleType is more appropriate,
so the normalization rule should be

  [attribute()]sequencetype
  ==
  attribute of type xs:anySimpleType

This example shows that errors in the specification can be 
uncovered by simply attempting to spell out all the defaults
explicitly in the rules.
Comment 1 Jerome Simeon 2005-07-20 23:48:55 UTC
I essentially agree with the intent. We should notably make sure we go over the
document to see if we find other problems than the one you mention.

Having defaults everywhere will make the examples unnecessarily unreadable
though. I would like to propose an intermediate compromise which would be:

 * define default only for use in examples
 * make sure that none the formal rules use any default

Any comment on that approach?
- Jerome
Comment 2 Michael Rys 2005-07-22 16:48:51 UTC
The WG discussed this issue and asked the editors to improve the understanding 
of defaults in the document while taking your feedback and the discussion 
within the working group into account.

Feel free to close the bug if you agree with the resolution. If you disagree, 
feel free to reopen it.