<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 1056: Must all Engines and Distributions be Streamable?</title>
<meta property="og:title" content="Issue 1056: Must all Engines and Distributions be Streamable?">
<meta property="og:description" content="C++ library issue. Status: NAD">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue1056.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#NAD">NAD</a> status.</em></p>
<h3 id="1056"><a href="lwg-closed.html#1056">1056</a>. Must all Engines and Distributions be Streamable?</h3>
<p><b>Section:</b> 29.5 <a href="https://wg21.link/rand">[rand]</a> <b>Status:</b> <a href="lwg-active.html#NAD">NAD</a>
 <b>Submitter:</b> Alisdair Meredith <b>Opened:</b> 2009-03-12 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#rand">issues</a> in [rand].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#NAD">NAD</a> status.</p>
<p><b>Discussion:</b></p>

<p>
Both the concepts <code>RandomNumberEngine</code> and <code>RandomNumberDistribution</code> have
requirements to be <code>InputStreamable</code> and <code>OutputStreamable</code>.
</p>
<p>
I have no problems leaving the WP in an inconsistent state on the best-faith
assumption these concepts will be provided later, however disagree with the
proposers that these constraints are not separable, orthogonal to the basic
concepts of generating random number distributions.
</p>
<p>
These constraints should be dropped, and applied to specific algorithms as
needed.
</p>
<p>
If a more refined concept (certainly deemed useful by the proposers) is
proposed there is no objection, but the basic concept should not require
persistence via streaming.
</p>

<p><i>[
Batavia (2009-05):
]</i></p>

<blockquote><p>
Move to Open.
</p></blockquote>

<p><i>[
2009-05-31 Alisdair adds:
]</i></p>


<blockquote>
<p>
Working on constraining the stream iterators, I have a few more observations
to make on the concepts proposed while constraining the random number
facility.
</p>
<p>
While I still believe the concerns are orthogonal, I don't believe the
existing constraints go far enough either!  The goal we want to achieve is
not that a <code>RandomNumberEngine</code> / <code>RandomNumberDistribution</code> supports the stream
operators, but that it is <code>Serializable</code>.  I.e. there is a relationship
between the insert and extract operations that guarantees to restore the
state of the original object.  This implies a coupling of the concepts
together in a broader concept (<code>Serializable</code>) with at least one axiom to
assert the semantics.
</p>
<p>
One problem is that <code>istream</code> and <code>ostream</code> may be fundamentally different
types, although we can hook a relation if we are prepared to drop down to
the <code>char</code> type and <code>char_traits</code> template parameters.  Doing so ties us to a
form of serialization that demands implementation via the std iostreams
framework, which seems overly prescriptive.  I believe the goal is generally
to support serialization without regard to how it is expressed - although
this is getting even more inventive in terms of concepts we do not have
today.
</p>
</blockquote>

<p><i>[
2009-11-03 Alisdair adds:
]</i></p>


<blockquote>
<p>
I can't find the record in the wiki minutes, but it was agreed at both
Frankfurt and Santa Cruz that this issue is NAD.
</p>
<p>
The agreement in SC was that I would provide you with the rationale (see
below) to include when moving to NAD.
</p>
</blockquote>

<p><i>[
2009-11-03 Howard adds:
]</i></p>


<blockquote><p>
Moved to Tentatively NAD after 5 positive votes on c++std-lib.
</p></blockquote>


<p id="res-1056"><b>Proposed resolution:</b></p>


<p><b>Rationale:</b></p>
<p>
The issue suggests a more refined concept should be used if we want to
require streaming, to separate concerns from the basic
<code>RandomNumberEngine</code> behaviour.  In Frankfurt it was observed
that <code>RandomNumberEngine</code> <em>is</em> that more refined concept,
and the basic concept used in the framework is
<code>UniformRandomNumberGenerator</code>, which it refines.
</p>

<p>
We concur, and expect this to have no repurcussions re-writing this
clause now concepts are removed.
</p>





</body>
</html>
