|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54168 - sandbox/committee/LWG/proposals
From: dave_at_[hidden]
Date: 2009-06-21 22:33:40
Author: dave
Date: 2009-06-21 22:33:39 EDT (Sun, 21 Jun 2009)
New Revision: 54168
URL: http://svn.boost.org/trac/boost/changeset/54168
Log:
Tidied. Sorry, but I couldn't read it to edit it and I don't have any
WYSIWYG text editor that imports it in such a way that I can work with
it. Feel free to un-tidy again if you wish.
Text files modified:
sandbox/committee/LWG/proposals/Intentional | 435 +++++++++++++++++++++++----------------
1 files changed, 259 insertions(+), 176 deletions(-)
Modified: sandbox/committee/LWG/proposals/Intentional Concept Mapping.html
==============================================================================
--- sandbox/committee/LWG/proposals/Intentional Concept Mapping.html (original)
+++ sandbox/committee/LWG/proposals/Intentional Concept Mapping.html 2009-06-21 22:33:39 EDT (Sun, 21 Jun 2009)
@@ -1,203 +1,286 @@
-<html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
-<meta name="ProgId" content="FrontPage.Editor.Document">
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<title>Intentional Concept Mapping</title>
-<style type="text/css">
+ <meta name="GENERATOR" content="Microsoft FrontPage 5.0" />
+ <meta name="ProgId" content="FrontPage.Editor.Document" />
+ <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
+
+ <title>Intentional Concept Mapping</title>
+ <style type="text/css">
+/*<![CDATA[*/
ins {background-color:#A0FFA0}
del {background-color:#FFA0A0}
-</style>
+ /*]]>*/
+ </style>
</head>
<body>
+ <table border="0" cellpadding="0" cellspacing="0" style=
+ "border-collapse: collapse" bordercolor="#111111">
+ <tr>
+ <td valign="top">Document number: <br />
+ Date:<br />
+ Project:<br />
+ Reply-to:</td>
+
+ <td>D2916=09-0106<br />
+ <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y-%m-%d" startspan -->2009-06-21<!--webbot bot="Timestamp" endspan i-checksum="12414" --><br />
+
+ Programming Language C++, Library Working Group<br />
+ David Abrahams <dave at boostpro dot com<br />
+ Beman Dawes <bdawes at acm dot org></td>
+ </tr>
+ </table>
+
+ <h1>Intentional Concept Mapping</h1>
+
+ <h2>Introduction</h2>
+
+ <p>Uses of C++0x concept maps include:</p>
+
+ <ul>
+ <li>Declaring the intention that a class models a concept, expressed in
+ code rather than in documentation.<br />
+ </li>
+
+ <li>Declaring to users and maintainers of the type that modeling the
+ concept is part of the type's public interface and not just happenstance;
+ i.e. it is a property that can be counted on and must be preserved as the
+ code evolves.</li>
+ </ul>
+
+ <p>As of CD1, this is expressed with concept maps that are often empty:</p>
-<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
- <tr>
- <td valign="top">Document number: <br>
- Date:<br>
- Project:<br>
- Reply-to:</td>
- <td>D2916=09-0106<br>
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y-%m-%d" startspan -->2009-06-21<!--webbot bot="Timestamp" endspan i-checksum="12414" --><br>
- Programming Language C++, Library Working Group<br>
- David Abrahams <dave at boostpro dot com<br>
- Beman Dawes <bdawes at acm dot org></td>
- </tr>
-</table>
-
-<h1>Intentional Concept Mapping</h1>
-<h2>Introduction</h2>
-<p>Uses of C++0x concept maps include:</p>
-<ul>
- <li>Declaring the intention that a class models a concept, expressed in code
- rather than in documentation.<br>
- </li>
- <li>Declaring to users and maintainers of the type that modeling the concept
- is part of the type's public interface and not just happenstance; i.e. it is a
- property that can be counted on and must be preserved as the code evolves.</li>
-</ul>
-<p>As of CD1, this is expressed with concept maps that are often empty:</p>
-<blockquote>
- <pre>class Endian
+ <blockquote>
+ <pre>
+class Endian
{
...
-};</pre>
- <pre>concept_map std::Regular<Endian> {}
+};
+</pre>
+ <pre>
+concept_map std::Regular<Endian> {}
concept_map std::StandardLayoutType<Endian> {}
-concept_map std::TrivialType<Endian> {}</pre>
-</blockquote>
-<p>Although this formulation is technically sufficient and will ensure the type
-models the concepts, it has some problems:</p>
-<ul>
- <li>The location of the concept maps after the class definition subverts
- self-documentation, particularly for large classes, negating some of the value
- as documentation to users and maintainers.<br>
- </li>
- <li>Specifying the concept maps after the class definition tends to push this
- important activity until later in the development cycle, yet from a
- design and testing standpoint it best occurs early on in the development
- cycle.<br>
- </li>
- <li>The empty concept maps are excessively verbose.</li>
-</ul>
-<p>This paper proposes that the above could also be written as:</p>
-<blockquote>
- <pre>class Endian -> std::Regular, std::StandardLayoutType, std::TrivialType
+concept_map std::TrivialType<Endian> {}
+</pre>
+ </blockquote>
+
+ <p>Although this formulation is technically sufficient and will ensure the
+ type models the concepts, it has some problems:</p>
+
+ <ul>
+ <li>The location of the concept maps after the class definition subverts
+ self-documentation, particularly for large classes, negating some of the
+ value as documentation to users and maintainers.<br />
+ </li>
+
+ <li>Specifying the concept maps after the class definition tends to push
+ this important activity until later in the development cycle, yet
+ from a design and testing standpoint it best occurs early on in the
+ development cycle.<br />
+ </li>
+
+ <li>The empty concept maps are excessively verbose.</li>
+ </ul>
+
+ <p>This paper proposes that the above could also be written as:</p>
+
+ <blockquote>
+ <pre>
+class Endian -> std::Regular, std::StandardLayoutType, std::TrivialType
{
...
-};</pre>
-</blockquote>
-<h2>Syntax</h2>
-<p>The proposed wording uses <code>-></code> as a syntax marker for the
-beginning of the list of concepts to be mapped. The authors are not wedded to
-<code>-></code> , and considered several alternate keyword and punctuation
-possibilities.</p>
-<p>The first keyword considered was <code>requires</code>, but it was rejected
-because when you write:</p>
-<blockquote>
- <pre>template <typename X>
- requires<EqualityComparable<X> >
+};
+</pre>
+ </blockquote>
+
+ <h2>Syntax</h2>
+
+ <p>The proposed wording uses <code>-></code> as a syntax marker for the
+ beginning of the list of concepts to be mapped. The authors are not wedded
+ to <code>-></code> , and considered several alternate keyword and
+ punctuation possibilities.</p>
+
+ <p>The first keyword considered was <code>requires</code>, but it was
+ rejected because when you write:</p>
+
+ <blockquote>
+ <pre>
+template <typename X>
+ requires<EqualityComparable<X> >
class Y
{
...
-};</pre>
-</blockquote>
-<p>you're just constraining X, nothing more. It's pure requirement checking.
- When you write:</p>
-<blockquote>
- <pre>template <typename X>
+};
+</pre>
+ </blockquote>
+
+ <p>you're just constraining X, nothing more. It's pure requirement
+ checking. When you write:</p>
+
+ <blockquote>
+ <pre>
+template <typename X>
class Y -> EqualityComparable
{
...
-};</pre>
-</blockquote>
-<p>you're generating a concept map for all specializations of Y, with all that
-that implies (e.g. generation of defaults, Y<T> can be used where
-EqualityComparable is required, etc):</p>
-<blockquote>
- <pre>// implied by the above
+};
+</pre>
+ </blockquote>
+
+ <p>you're generating a concept map for all specializations of Y, with all
+ that that implies (e.g. generation of defaults, Y<T> can be used
+ where EqualityComparable is required, etc):</p>
+
+ <blockquote>
+ <pre>
+// implied by the above
template <typename T>
-concept_map EqualityComparable<Y<T> > { };</pre>
-</blockquote>
-<p>A concept_map is fundamentally different from a requires clause in other
-ways, too: the former can only occur in unconstrained contexts while the latter
-can only occur in constrained ones.</p>
-<p>We welcome syntax suggestions from the committee.</p>
-<h2>Motivation</h2>
-<p>The critical motivation for this proposal is the desire to be able to say "my
-type models concepts XXX, YYY, and ZZZ, and is broken if it doesn't do that",
-and do that in such a way that users and maintainers understand that this is
-part of my type's public interface and not just happenstance.</p>
-<p>This proposal is not replacement for concept maps; we view concept maps -
-even empty ones - as meeting critical needs. We wish to make empty concept maps
-more convenient and less verbose, not replace them entirely..</p>
-<p>The motivating problem of not being able to say what we mean in the obvious
-place is not solved by making more concepts <code>auto</code> or making <code>
-auto</code> the default. Those are important issues, but are orthogonal to the
-intentional concept mapping concerns of this proposal.</p>
-<h2>Proposed Wording</h2>
-<p><i>Change 9 Classes [class] as indicated:</i></p>
-<blockquote>
-<p>A class is a type. Its name becomes a <i>class-name</i> (9.1) within its
-scope.</p>
- <blockquote>
-<p><i>class-name:<br>
- identifier<br>
- simple-template-id</i></p>
- </blockquote>
-<p><i>Class-specifiers</i> and <i>elaborated-type-specifiers</i> (7.1.6.3) are
-used to make <i>class-names</i>. An object of a class consists of a (possibly
-empty) sequence of members and base class objects.</p>
- <blockquote>
-<p><i>class-specifier:<br>
- class-head </i><code>{</code><i> member-specification<sub>opt</sub>
-</i><code>}</code></p>
-<p><i>class-head:<br>
- class-key identifier<sub>opt</sub> attribute-specifier<sub>opt</sub>
-<ins>mapped-concept-clause<sub>opt</sub></ins> base-clause<sub>opt</sub><br>
- class-key nested-name-specifier identifier
-attribute-specifier<sub>opt</sub>
-<ins>mapped-concept-clause<sub>opt</sub></ins> base-clause<sub>opt</sub><br>
- class-key nested-name-specifier<sub>opt</sub>
-simple-template-id attribute-specifier<sub>opt</sub>
-<ins>mapped-concept-clause<sub>opt</sub></ins> base-clause<sub>opt</sub></i></p>
-<p><i>class-key:</i><br>
-<i> </i><code>class</code><br>
-<i> </i><code>struct</code><br>
-<i> </i><code>union</code></p>
- </blockquote>
-</blockquote>
-<p><i>After 9.9
-Nested type names [class.nested.type], add:</i></p>
-<blockquote>
-<p><b>9.10 Intentional concept mapping [class.concept.mapping]</b></p>
- <blockquote>
-<p><i>mapped-concept-clause:<br>
- </i><code>-></code><i> mapped-concept-list</i></p>
-<p><i>mapped-concept-list:<br>
- mapped-concept<code>,</code> mapped-concept-list<br>
- mapped-concept</i></p>
-<p><i>mapped-concept:<br>
- </i>
-<code>::</code><i><sub>opt</sub> nested-name-specifier<sub>opt</sub>
-concept-name</i></p>
- </blockquote>
-<p>A <i>concepts-clause</i> contains a list of concepts to map to. A concept is
-mapped to for each <i>mapped-concept</i> as if by a <code>
-concept_map</code>([concept.map]). The <code>
-concept_map</code> acts as if appears immediately after the class being defined,
-and is equivalent to:</p>
+concept_map EqualityComparable<Y<T> > { };
+</pre>
+ </blockquote>
+
+ <p>A concept_map is fundamentally different from a requires clause in other
+ ways, too: the former can only occur in unconstrained contexts while the
+ latter can only occur in constrained ones.</p>
+
+ <p>We welcome syntax suggestions from the committee.</p>
+
+ <h2>Motivation</h2>
+
+ <p>The critical motivation for this proposal is the desire to be able to
+ say "my type models concepts XXX, YYY, and ZZZ, and is broken if it doesn't
+ do that", and do that in such a way that users and maintainers understand
+ that this is part of my type's public interface and not just
+ happenstance.</p>
+
+ <p>This proposal is not replacement for concept maps; we view concept maps
+ - even empty ones - as meeting critical needs. We wish to make empty
+ concept maps more convenient and less verbose, not replace them
+ entirely..</p>
+
+ <p>The motivating problem of not being able to say what we mean in the
+ obvious place is not solved by making more concepts <code>auto</code> or
+ making <code>auto</code> the default. Those are important issues, but are
+ orthogonal to the intentional concept mapping concerns of this
+ proposal.</p>
+
+ <h2>Proposed Wording</h2>
+
+ <p><i>Change 9 Classes [class] as indicated:</i></p>
+
<blockquote>
- <pre>concept_map <i>Concept</i><<i>Class</i>> {};</pre>
+ <p>A class is a type. Its name becomes a <i>class-name</i> (9.1) within
+ its scope.</p>
+
+ <blockquote>
+ <p><i>class-name:<br />
+ identifier<br />
+ simple-template-id</i></p>
+ </blockquote>
+
+ <p><i>Class-specifiers</i> and <i>elaborated-type-specifiers</i>
+ (7.1.6.3) are used to make <i>class-names</i>. An object of a class
+ consists of a (possibly empty) sequence of members and base class
+ objects.</p>
+
+ <blockquote>
+ <p><i>class-specifier:<br />
+ class-head</i> <code>{</code>
+ <i>member-specification<sub>opt</sub></i> <code>}</code></p>
+
+ <p><i>class-head:<br />
+ class-key identifier<sub>opt</sub>
+ attribute-specifier<sub>opt</sub>
+ <ins>mapped-concept-clause<sub>opt</sub></ins>
+ base-clause<sub>opt</sub><br />
+ class-key nested-name-specifier
+ identifier attribute-specifier<sub>opt</sub>
+ <ins>mapped-concept-clause<sub>opt</sub></ins>
+ base-clause<sub>opt</sub><br />
+ class-key
+ nested-name-specifier<sub>opt</sub> simple-template-id
+ attribute-specifier<sub>opt</sub>
+ <ins>mapped-concept-clause<sub>opt</sub></ins>
+ base-clause<sub>opt</sub></i></p>
+
+ <p><i>class-key:</i><br />
+ <i> </i> <code>class</code><br />
+ <i> </i> <code>struct</code><br />
+ <i> </i> <code>union</code></p>
+ </blockquote>
</blockquote>
- <p>where <i><code>Concept</code></i> is the <i>mapped-concept</i>, and <i> <code>Class</code></i>
- is the class where the <i>mapped-concept-clause</i> appears.</p>
- <p><i>[Example:</i></p>
+
+ <p><i>After 9.9 Nested type names [class.nested.type], add:</i></p>
+
<blockquote>
- <pre>template <typename X>
- class Y -> EqualityComparable
- {
+ <p><b>9.10 Intentional concept mapping [class.concept.mapping]</b></p>
+
+ <blockquote>
+ <p><i>mapped-concept-clause:<br />
+ </i> <code>-></code>
+ <i>mapped-concept-list</i></p>
+
+ <p><i>mapped-concept-list:<br />
+ mapped-concept<code>,</code>
+ mapped-concept-list<br />
+ mapped-concept</i></p>
+
+ <p><i>mapped-concept:<br />
+ </i> <code>::</code><i><sub>opt</sub>
+ nested-name-specifier<sub>opt</sub> concept-name</i></p>
+ </blockquote>
+
+ <p>A <i>concepts-clause</i> contains a list of concepts to map to. A
+ concept is mapped to for each <i>mapped-concept</i> as if by a
+ <code>concept_map</code>([concept.map]). The <code>concept_map</code>
+ acts as if appears immediately after the class being defined, and is
+ equivalent to:</p>
+
+ <blockquote>
+ <pre>
+concept_map <i>Concept</i><<i>Class</i>> {};
+</pre>
+ </blockquote>
+
+ <p>where <i><code>Concept</code></i> is the <i>mapped-concept</i>, and
+ <i><code>Class</code></i> is the class where the
+ <i>mapped-concept-clause</i> appears.</p>
+
+ <p><i>[Example:</i></p>
+
+ <blockquote>
+ <pre>
+template <typename X>
+ class Y -> EqualityComparable
+ {
...
- };</pre>
- <p>Generates a concept map for all specializations of Y, with all that that
- implies (e.g. generation of defaults, Y<T> can be used where
- EqualityComparable is required, etc):</p>
- <pre>// implied by the above
+ };
+</pre>
+
+ <p>Generates a concept map for all specializations of Y, with all that
+ that implies (e.g. generation of defaults, Y<T> can be used where
+ EqualityComparable is required, etc):</p>
+ <pre>
+// implied by the above
template <typename T>
- concept_map EqualityComparable< Y<T> > {};</pre>
-</blockquote>
-<p><i>--end example]</i></p>
-</blockquote>
-<h2>Acknowledgements</h2>
-<p>Several people on the committee reflectors suggested features similar to this
-proposal, often with syntax using the <code>requires</code> keyword. Jerry
-Schwarz, in committee message c++std-lib-23459, suggested syntax that mimics
-inheritance.</p>
-<hr>
-<p> </p>
+ concept_map EqualityComparable< Y<T> > {};
+</pre>
+ </blockquote>
-</body>
+ <p><i>--end example]</i></p>
+ </blockquote>
+
+ <h2>Acknowledgements</h2>
-</html>
\ No newline at end of file
+ <p>Several people on the committee reflectors suggested features similar to
+ this proposal, often with syntax using the <code>requires</code> keyword.
+ Jerry Schwarz, in committee message c++std-lib-23459, suggested syntax that
+ mimics inheritance.</p>
+ <hr />
+
+ <p> </p>
+</body>
+</html>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk