Boost logo

Boost-Commit :

From: joaquin_at_[hidden]
Date: 2008-01-18 11:34:34


Author: joaquin
Date: 2008-01-18 11:34:34 EST (Fri, 18 Jan 2008)
New Revision: 42848
URL: http://svn.boost.org/trac/boost/changeset/42848

Log:
review version
Added:
   sandbox/flyweight/libs/flyweight/doc/future_work.html (contents, props changed)
   sandbox/flyweight/libs/flyweight/doc/review_notes.html (contents, props changed)

Added: sandbox/flyweight/libs/flyweight/doc/future_work.html
==============================================================================
--- (empty file)
+++ sandbox/flyweight/libs/flyweight/doc/future_work.html 2008-01-18 11:34:34 EST (Fri, 18 Jan 2008)
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Boost.Flyweight Documentation - Future work</title>
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="start" href="examples.html">
+<link rel="prev" href="tests.html">
+<link rel="up" href="index.html">
+<link rel="next" href="review_notes.html">
+</head>
+
+<body>
+<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)" align=
+"middle" width="277" height="86">Boost.Flyweight Future work</h1>
+
+<div class="prev_link"><a href="examples.html"><img src="prev.gif" alt="examples" border="0"><br>
+Examples
+</a></div>
+<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
+Index
+</a></div>
+<div class="next_link"><a href="review_notes.html"><img src="next.gif" alt="review notes" border="0"><br>
+Review notes
+</a></div><br clear="all" style="clear: all;">
+<br clear="all" style="clear: all;">
+
+<hr>
+
+<h3 align="center">Disclaimer: Boost.Flyweight is not a Boost library</h3>
+
+<p>
+New functionalities can be included into future releases of Boost.Flyweight
+to meet the demands of users and to leverage upcoming C++0x features
+and new Boost libraries. The following is a list of candidate additions.
+</p>
+
+<h2>Contents</h2>
+
+<ul>
+ <li>Introspection API</li>
+ <li>Perfect forwarding</li>
+ <li>Integration with new Boost libraries</li>
+</ul>
+
+<h2><a name="instrospection">Introspection API</a></h2>
+
+<p>
+Currently there is no way to access the internal components of a
+<code>flyweight</code> instantiation (factory, holder, etc.) or even
+to know the types of these components. With such an API it would be
+possible to instrument and monitor the usage of Boost.Flyweight like in
+the following example:
+</p>
+
+<blockquote><pre>
+<span class=keyword>typedef</span> <span class=identifier>flyweight</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>&gt;</span> <span class=identifier>fw_type</span><span class=special>;</span>
+<span class=special>...</span>
+<span class=identifier>std</span><span class=special>::</span><span class=identifier>cout</span><span class=special>&lt;&lt;</span><span class=string>&quot;factory used: &quot;</span><span class=special>&lt;&lt;</span><span class=keyword>typeid</span><span class=special>(</span><span class=identifier>fw_type</span><span class=special>::</span><span class=identifier>factory_type</span><span class=special>).</span><span class=identifier>name</span><span class=special>()&lt;&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;</span>
+<span class=identifier>std</span><span class=special>::</span><span class=identifier>cout</span><span class=special>&lt;&lt;</span><span class=string>&quot;values stored: &quot;</span><span class=special>&lt;&lt;</span><span class=identifier>fw_type</span><span class=special>::</span><span class=identifier>factory</span><span class=special>().</span><span class=identifier>size</span><span class=special>()&lt;&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;</span>
+</pre></blockquote>
+
+<h2><a name="perfect_fwd">Perfect forwarding</a></h2>
+
+<p>
+When constructing a <code>flyweight&lt;T&gt; object</code>, some spurious copies
+of objects of type <code>T</code> are incurred in the process of moving the value
+into the internal factory. So-called <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2027.html#Perfect_Forwarding"><i>perfect
+forwarding</i></a>, i.e. performing the move without generating temporary
+copies, will be solved in an optimum manner by a new
+type of <i>rvalue references</i> to be included in the next revision of the
+C++ standard. Boost.Flyweight will take advantage of this feature as
+compilers begin to provide it.
+</p>
+
+<h2><a name="new_boost_libs">Integration with new Boost libraries</a></h2>
+
+<p>
+Recently accepted Boost libraries like
+Boost.Functional/Forward
+and Boost.Functional/Factory
+might be used in the future to replace some internal machinery of
+Boost.Flyweight.
+</p>
+
+<hr>
+
+<div class="prev_link"><a href="examples.html"><img src="prev.gif" alt="examples" border="0"><br>
+Examples
+</a></div>
+<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
+Index
+</a></div>
+<div class="next_link"><a href="review_notes.html"><img src="next.gif" alt="review notes" border="0"><br>
+Review notes
+</a></div><br clear="all" style="clear: all;">
+<br clear="all" style="clear: all;">
+
+<br>
+
+<p>Revised January 9th 2008</p>
+
+<p>&copy; Copyright 2006-2008 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
+Distributed under the Boost Software
+License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
+LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
+http://www.boost.org/LICENSE_1_0.txt>)
+</p>
+
+</body>
+</html>

Added: sandbox/flyweight/libs/flyweight/doc/review_notes.html
==============================================================================
--- (empty file)
+++ sandbox/flyweight/libs/flyweight/doc/review_notes.html 2008-01-18 11:34:34 EST (Fri, 18 Jan 2008)
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
+
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Boost.Flyweight Documentation - Review notes</title>
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="start" href="index.html">
+<link rel="prev" href="future_work.html">
+<link rel="up" href="index.html">
+<link rel="next" href="acknowledgements.html">
+</head>
+
+<body>
+<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)" align=
+"middle" width="277" height="86">Boost.Flyweight Review notes</h1>
+
+<div class="prev_link"><a href="future_work.html"><img src="prev.gif" alt="future work" border="0"><br>
+Future work
+</a></div>
+<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
+Index
+</a></div>
+<div class="next_link"><a href="acknowledgements.html"><img src="next.gif" alt="acknowledgements" border="0"><br>
+Acknowledgements
+</a></div><br clear="all" style="clear: all;">
+<br clear="all" style="clear: all;">
+
+<hr>
+
+<h3 align="center">Disclaimer: Boost.Flyweight is not a Boost library</h3>
+
+<p>
+Thank you for participating in the review of candidate Boost.Flyweight.
+These are some particular issues that I would like to see discussed
+during the review process.
+</p>
+
+<h2><a name="equality">Equality semantics</a></h2>
+
+<p>
+Consider the code:
+</p>
+
+<blockquote><pre>
+<span class=identifier>flyweight</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=identifier>fw1</span><span class=special>,</span><span class=identifier>fw2</span><span class=special>;</span>
+<span class=special>...</span>
+<span class=keyword>bool</span> <span class=identifier>b</span><span class=special>=(</span><span class=identifier>fw1</span><span class=special>==</span><span class=identifier>fw2</span><span class=special>);</span>
+</pre></blockquote>
+
+<p>
+The comparison between <code>fw1</code> and <code>fw2</code> does <i>not</i>
+resort to the underlying values:
+</p>
+
+<blockquote><pre>
+<span class=keyword>bool</span> <span class=identifier>b</span><span class=special>=(</span><span class=identifier>fw1</span><span class=special>.</span><span class=identifier>get</span><span class=special>()==</span><span class=identifier>fw2</span><span class=special>.</span><span class=identifier>get</span><span class=special>());</span> <span class=comment>// This is *not* equivalent to fw1==fw2</span>
+</pre></blockquote>
+
+<p>
+but instead two <code>flyweight</code> objects are considered equal if
+they share their value:
+</p>
+
+<blockquote><pre>
+<span class=keyword>bool</span> <span class=identifier>b</span><span class=special>=(&amp;(</span><span class=identifier>fw1</span><span class=special>.</span><span class=identifier>get</span><span class=special>())==&amp;(</span><span class=identifier>fw2</span><span class=special>.</span><span class=identifier>get</span><span class=special>()));</span> <span class=comment>// This is equivalent to fw1==fw2</span>
+</pre></blockquote>
+
+<p>
+(Unlike <code>==</code>, the rest of comparison predicates just
+forward to the corresponding <code>T</code> operators.) There are
+advantages in adopting this implementation:
+<ul>
+ <li>Equality comparison never throws and is extremely fast.</li>
+ <li>Equality is tested in constant time: this is specially significant
+ when recursive types are involved, as in the
+
composite sample in the
+ examples section.
+ </li>
+</ul>
+</p>
+
+<p>
+But there are potential drawbacks as well:
+<ul>
+ <li>The resulting equality semantics might not coincide with that of
+ the underlying <code>T</code>; the possibility of this hapenning
+ and making a real difference is probably small, though.
+ </li>
+ <li>The assumption that equal <code>flyweight</code> objects always
+ share their value interfere with potential extensions to the
+ library, like the
+ <a href="http://lists.boost.org/Archives/boost/2007/12/131620.php">no-factory
+ proposal</a> by Throsten Ottosen.
+</ul>
+Which option do you prefer, implementing equality of <code>fw1</code> and
+<code>fw2</code> as <code>&amp;(fw1.get())==&amp;(fw1.get())</code> (the current
+solution) or as <code>fw1.get()==fw1.get()</code>?
+</p>
+
+<h2><a name="simpler_config">Alternative/simpler configuration interface</a></h2>
+
+<p>
+An aim of Boost.Flyweight is to provide maximum customizability so as to
+meet everybody's needs from basic users to programmers with very
+specific requirements. To accomplish this goal the <code>flyweight</code>
+class template presents a very fine grained policy-based configuration
+interface. Peter Dimov has argued, however, that the interface
+between <code>flyweight</code> front-end and its implementation core
+could be made <a href="http://lists.boost.org/Archives/boost/2007/12/131684.php">much
+simpler</a> without resorting to such policy decomposition.
+</p>
+
+<p>
+A third alternative is to give credit to both approaches and blend them
+into a configuration interface like this:
+</p>
+
+<blockquote><pre>
+<span class=comment>// default configuration</span>
+<span class=keyword>typedef</span> <span class=identifier>flyweight</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=identifier>fw_t1</span><span class=special>;</span>
+
+<span class=comment>// change core</span>
+<span class=keyword>typedef</span> <span class=identifier>flyweight</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>,</span><span class=identifier>shared_ptr_core</span><span class=special>&gt;</span> <span class=identifier>fw_t2</span><span class=special>;</span>
+
+<span class=comment>// change some aspect of the default core</span>
+<span class=keyword>typedef</span> <span class=identifier>flyweight</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>,</span><span class=identifier>default_core</span><span class=special>&lt;</span><span class=identifier>no_tracking</span><span class=special>&gt;</span> <span class=special>&gt;</span> <span class=identifier>fw_t3</span><span class=special>;</span>
+</pre></blockquote>
+
+<p>
+The policy-based configuration interface gets nested into a default
+core component, which alternatively can be entirely replaced
+by a custom core. This is maximally flexible, but complicates the
+design of the library and demands a slightly less terse syntax.
+What is your opinion on this issue?
+</p>
+
+<hr>
+
+<div class="prev_link"><a href="future_work.html"><img src="prev.gif" alt="future work" border="0"><br>
+Future work
+</a></div>
+<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
+Index
+</a></div>
+<div class="next_link"><a href="acknowledgements.html"><img src="next.gif" alt="acknowledgements" border="0"><br>
+Acknowledgements
+</a></div><br clear="all" style="clear: all;">
+<br clear="all" style="clear: all;">
+
+<br>
+
+<p>Revised January 16th 2008</p>
+
+<p>&copy; Copyright 2006-2008 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
+Distributed under the Boost Software
+License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
+LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
+http://www.boost.org/LICENSE_1_0.txt>)
+</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