<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>3232</bug_id>
          
          <creation_ts>2006-05-09 10:06:15 +0000</creation_ts>
          <short_desc>Type versus Datatype</short_desc>
          <delta_ts>2008-05-16 17:17:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XML Schema</product>
          <component>Datatypes: XSD Part 2</component>
          <version>1.1 only</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>cluster: terminology</status_whiteboard>
          <keywords>resolved</keywords>
          <priority>P4</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="C. M. Sperberg-McQueen">cmsmcq</assigned_to>
          
          
          <qa_contact name="XML Schema comments list">www-xml-schema-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>9644</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-05-09 10:06:15 +0000</bug_when>
    <thetext>QT approved comment:

In 2.6.1.2, the second paragraph is an example of a residual use of the
word &quot;type&quot; rather than &quot;datatype&quot;. This also occurs in constructs such as
&quot;base type&quot; and &quot;item type&quot;. It&apos;s not clear whether the spec is trying to
make a distinction between the two words. &quot;Union type&quot; and &quot;union datatype&quot;
are used apparently interchangeably.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9722</commentid>
    <comment_count>1</comment_count>
    <who name="Dave Peterson">davep</who>
    <bug_when>2006-05-09 18:20:39 +0000</bug_when>
    <thetext>(In reply to comment #0)

&gt; In 2.6.1.2, the second paragraph is an example of a residual use of the
&gt; word &quot;type&quot; rather than &quot;datatype&quot;. This also occurs in constructs such as
&gt; &quot;base type&quot; and &quot;item type&quot;. It&apos;s not clear whether the spec is trying to
&gt; make a distinction between the two words. &quot;Union type&quot; and &quot;union datatype&quot;
&gt; are used apparently interchangeably.

We have tried in 1.1 to remove the unmodified word &apos;type&apos; from running text,
but not from the names of schema component properties (which would be
a gratuitous change to the component structure, a thing roundly hated by
many implementers who use it to define their APIs and UIs).  Probably some
in text have been missed.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18743</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-02-04 23:46:50 +0000</bug_when>
    <thetext>I might mention that I&apos;ve been having the same problem with the words &quot;type&quot; and &quot;data type&quot; (and &quot;datatype&quot;) in my XSLT book; the copy editors have been going crazy trying to get the usage consistent, and in the end I&apos;ve given up and decided that &quot;data&quot; adds nothing to the sense, so it&apos;s been removed everywhere. This seems to work perfectly well once you get used to it. Types partition into complex and simple, simple types partition into union, list, and atomic: there&apos;s no room in this hierarchy for another adjective &quot;data&quot;. (What do you call a type that isn&apos;t a data type?)

The most prominent usage of &quot;Datatypes&quot; is of course in the title of part 2, which should probably be &quot;Simple Types&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18757</commentid>
    <comment_count>3</comment_count>
    <who name="Dave Peterson">davep</who>
    <bug_when>2008-02-05 03:23:44 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; I might mention that I&apos;ve been having the same problem with the words &quot;type&quot;
&gt; and &quot;data type&quot; (and &quot;datatype&quot;) in my XSLT book; the copy editors have been
&gt; going crazy trying to get the usage consistent, and in the end I&apos;ve given up
&gt; and decided that &quot;data&quot; adds nothing to the sense, so it&apos;s been removed
&gt; everywhere. This seems to work perfectly well once you get used to it. Types
&gt; partition into complex and simple, simple types partition into union, list, and
&gt; atomic: there&apos;s no room in this hierarchy for another adjective &quot;data&quot;. (What
&gt; do you call a type that isn&apos;t a data type?)

Well, SGML had element types defined by element type defintions, and they were specific subsets of the class of elements.  I generally found that in OO terminology, &quot;types&quot; were subsets of a class that were effectively defined by a specified mechanism applied to certain objects, which were equated with the subclass they defined.  An object *has* properties and a class restricts properties; if several objects use their property values to further restrict the instances of a class according to the same rule, they are
&quot;types&quot; of that class.  E.g., the class is element; the objects have certain properties; element type definitions specify values for the properties; the resulting objects are element *types* whose property values select out certain subclasses of element according to a uniform rule.

As I see it, simple and compound types are intermediate between element and the element types of XML (defined by the unfortunately renamed &quot;element definition&quot;, really still an element type definition).  As such, they define subclasses of element (i.e., the class of which elements and only elements are instances).

Accordingly, we still have element types, we have simple types, we have complex types; they all are subclasses of element.  The things we define in Part 2 and call datatypes are different animals.  And we have four different things we call &quot;types&quot;; I think we should try to consistently say which kind we&apos;re talking about.

We did feel that if we always called them datatypes in text, we didn&apos;t have to rename the names of the properties, which could cause possibly significant reprogramming for those systems that choose to use our abstractions to define their user interface or API.

&gt; The most prominent usage of &quot;Datatypes&quot; is of course in the title of part 2,
&gt; which should probably be &quot;Simple Types&quot;.

I disagree;  a simple type is a subclass of element.  Our datatypes are not classes of elements.  They are what mathematicians and logicians sometimes call &quot;mathematical systems&quot; and computer scientists often call &quot;datatypes&quot;.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18770</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-02-05 08:17:28 +0000</bug_when>
    <thetext>&gt;As I see it, simple and compound types are intermediate between element and the
element types of XML (defined by the unfortunately renamed &quot;element
definition&quot;, really still an element type definition).  As such, they define
subclasses of element (i.e., the class of which elements and only elements are
instances).

Well, I don&apos;t see it that way at all. When I define a simpleType by restriction from xs:integer, I&apos;m not defining a subclass of elements. The simpleType might never be used as the type of an element, or for that matter an attribute. It might only be used as the type of an XQuery function parameter, for example.

As far as I can see, the words &quot;datatype&quot; and &quot;simple type&quot; are pure synonyms. If you don&apos;t think so, can you point to some objects that belong to one category and not to the other?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18775</commentid>
    <comment_count>5</comment_count>
    <who name="Noah Mendelsohn">noah_mendelsohn</who>
    <bug_when>2008-02-05 19:17:20 +0000</bug_when>
    <thetext>Michael Kay writes:

&gt; As far as I can see, the words &quot;datatype&quot;
&gt; and &quot;simple type&quot; are pure synonyms.

I always found the distinction confusing, but I vaguely recall that there is one.  Or, stated differently, I vaguely recall that when this question came up a few years ago that a resolution was proposed.  I &gt;think&lt; it was:

Simple Type: The combination of a lexical space, a value space, definitions of certain relations like equality, and maybe a few other things I&apos;m forgetting.

Datatype: A component in the schema component graph, typically used to specify the definition of a Simple Type through use of facets.

That said, I was never terribly optimistic that users would like or remember this distinction.  I&apos;m not particularly an advocate for this terminology, but neither did I object strongly nor have sufficiently better alternatives to propose.  Anyway, that&apos;s my somewhat hazy recollection of what the difference was supposed to be.   Can anyone verify that I do or don&apos;t have this right?  Thanks.

Noah</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18776</commentid>
    <comment_count>6</comment_count>
    <who name="Dave Peterson">davep</who>
    <bug_when>2008-02-05 19:52:14 +0000</bug_when>
    <thetext>(In reply to comment #4)

&gt;Well, I don&apos;t see it that way at all. When I define a simpleType by restriction
&gt;from xs:integer, I&apos;m not defining a subclass of elements. The simpleType might
&gt;never be used as the type of an element, or for that matter an attribute. It
&gt;might only be used as the type of an XQuery function parameter, for example.

I&apos;d say you&apos;re not defining simple types by restriction, you&apos;re defining datatypes by restriction.  I don&apos;t like conflating the two terms--that does get confusing.  I&apos;d like to keep &quot;simple type&quot; and &quot;complex type&quot; as parallel things; I don&apos;t see an analog for &quot;complex type&quot; as a mathematical structure/system.

(In reply to comment #5)
&gt; Michael Kay writes:
&gt; 
&gt; &gt; As far as I can see, the words &quot;datatype&quot;
&gt; &gt; and &quot;simple type&quot; are pure synonyms.
&gt; 
&gt; I always found the distinction confusing, but I vaguely recall that there is
&gt; one.  Or, stated differently, I vaguely recall that when this question came up
&gt; a few years ago that a resolution was proposed.  I &gt;think&lt; it was:
&gt; 
&gt; Simple Type: The combination of a lexical space, a value space, definitions of
&gt; certain relations like equality, and maybe a few other things I&apos;m forgetting.

Backwards.  That&apos;s a datatype.

&gt; Datatype: A component in the schema component graph, typically used to specify
&gt; the definition of a Simple Type through use of facets.

And that&apos;s a simple type *definition*.

&gt; That said, I was never terribly optimistic that users would like or remember
&gt; this distinction.  I&apos;m not particularly an advocate for this terminology, but
&gt; neither did I object strongly nor have sufficiently better alternatives to
&gt; propose.  Anyway, that&apos;s my somewhat hazy recollection of what the difference
&gt; was supposed to be.   Can anyone verify that I do or don&apos;t have this right? 

See above.  As far as I know, we do not anywhere define &quot;simple type&quot; (as opposed to &quot;simple type definition&quot;) or &quot;complex type&quot; (as opposed to &quot;complex type definition&quot;).  I&apos;ve tried to use &quot;simple type&quot; and &quot;complex type&quot; as analogs of SGML&apos;s &quot;element type&quot; (since the STD/CTDs are analogs of SGML&apos;s element type definitions--which are misnamed &quot;element definitions&quot; in XML), and in accordance with what I take to be at least one version of common usage in the OO community.

AFAIK, &quot;datatype&quot; used as I&apos;ve used it in Part 2 is rather standard CS terminology for things like that. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18777</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-02-05 20:29:49 +0000</bug_when>
    <thetext>OK, I&apos;ve got it now. A simple type definition doesn&apos;t define a simple type, it defines a datatype. Silly me. And silly any reader who claims that we make things unnecessarily complicated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18778</commentid>
    <comment_count>8</comment_count>
    <who name="Dave Peterson">davep</who>
    <bug_when>2008-02-05 20:49:47 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; OK, I&apos;ve got it now. A simple type definition doesn&apos;t define a simple type, it
&gt; defines a datatype. Silly me. And silly any reader who claims that we make
&gt; things unnecessarily complicated.

What do you think a complex type definition defines?  Do you know what a complex type is?  How does that match with what you believe a simple type is?

A simple type definition defines a particular subclass of the element class and attribute class (whose instances are elements and attributes respectively), which is what I&apos;ve been calling a &quot;simple type&quot;, *as well as* a datatype.  Not true that it doesn&apos;t define a simple type:  it defines both.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18779</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-02-05 21:06:50 +0000</bug_when>
    <thetext>I believe that a complex type definition defines a complex type. I think I know what a complex type is: it is a set of rules that can be used to constrain the contents of XML elements. 

Similarly I believe that a simple type definition defines a simple type; and a simple type is a set of rules that can be used, inter alia, to constrain the contents of XML elements and attributes. 

I know what datatypes are as a generic computer science term, but I don&apos;t know what they are in XML Schema, other than another name for simple types. Your last comment appears to agree with that.

I don&apos;t think we have to resort to concepts like &quot;element class&quot; - we have quite enough concepts already without inventing more.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18780</commentid>
    <comment_count>10</comment_count>
    <who name="Dave Peterson">davep</who>
    <bug_when>2008-02-05 21:51:31 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; I believe that a complex type definition defines a complex type. I think I know
&gt; what a complex type is: it is a set of rules that can be used to constrain the
&gt; contents of XML elements. 
&gt; 
&gt; Similarly I believe that a simple type definition defines a simple type; and a
&gt; simple type is a set of rules that can be used, inter alia, to constrain the
&gt; contents of XML elements and attributes. 

Good.  We agree.  Now what then does a simple type have to do with mathematical structures?

&gt; I know what datatypes are as a generic computer science term, but I don&apos;t know
&gt; what they are in XML Schema, other than another name for simple types. Your
&gt; last comment appears to agree with that.

In my last comment, I said &quot;it defines both&quot;.  If they were both the same thing, I wouldn&apos;t say that.  I guess appearances are in the eye of the beholder.

What can I say to get it across that in XML Schema, datatypes *are* those things that you see going by that name in computer science?  And they are *not* used simply &quot;to constrain the contents of XML elements and attributes&quot;, except as the XML Schema rules for validity using simple type definitions call upon the corresponding datatype for some calculations.

&gt; I don&apos;t think we have to resort to concepts like &quot;element class&quot; - we have
&gt; quite enough concepts already without inventing more.

Fear not; I wouldn&apos;t think of introducing it into the spec.  I&apos;m just using it here to show where my interpretations of &quot;simple type&quot; (and &quot;complex type&quot;) come from, and why I see them as different animals from &quot;datatype&quot;.  We&apos;ve not defined either of these and we&apos;ve tried to root out any occurrences of them (without the appended &quot;definition&quot;) in the spec itself.  For better or for worse; maybe we should have defined them just so people wouldn&apos;t wonder why we call the things that we do &quot;datatypes&quot;--but I&apos;m aware of no plan to do so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20033</commentid>
    <comment_count>11</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2008-05-06 16:45:48 +0000</bug_when>
    <thetext>A draft wording proposal intended to resolve this issue is on the
W3C server at 

  http://www.w3.org/XML/Group/2004/06/xmlschema-2/datatypes.b3232.html
  (member-only link)

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20147</commentid>
    <comment_count>12</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2008-05-16 17:17:41 +0000</bug_when>
    <thetext>On this morning&apos;s WG telcon, the XML Schema WG adopted the proposal
mentioned in comment #11.  So I am marking the issue resolved.

Michael Kay, as the originator of the issue, would you report back to QT
on this resolution and let us know whether they accept this resolution of
the issue?  If they agree, please so indicate by changing the record&apos;s
status to CLOSED; if they disagree, REOPEN it.  If we don&apos;t hear from you
in a reasonable amound of time (say, two weeks), we will assume that silence
implies consent.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>