Topic: D0196R0- A generic none_t literal type for Nullable


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 28 Jan 2016 08:37:21 +0100
Raw View
This is a multi-part message in MIME format.
--------------010408070305070101010809
Content-Type: text/plain; charset=UTF-8; format=flowed

Hi,

I've extracted the none literal from P0032R0 has requested in Kona. For
those that are not aware of the proposal, here it is the abstract

    In the same way we have/NullablePointer/types with|nullptr|to mean a
    null value, this proposal defines/Nullable/requirements for types
    for which|none|means the null value. This paper proposes a
    generic|none|literal for/Nullable/types like|optional|and|any|and
    proposes to replace the variant|monostate_t|defined inP0088R0
    <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0088r0.pdf>by|none_t|.

    Note that for/Nullable/types the null value doesn't mean an error,
    it is just a value different from all the other values, it is none
    of the other values.

    This takes in account the feedback from Kona meetingP0032R0
    <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0032r0.pdf>.
    The direction of the committee was:

      * Do we want|none_t|to be a separate paper?

    |SF F N A SA 11 1 3 0 0|

      *

        Do we want the|operator bool|changes? No, instead
        a|.something()|member function (e.g.|has_value|) is preferred
        for the 3 classes. This doesn't mean yet that we replace the
        existing explicit|operator bool|in|optional|.

      *

        Do we want emptiness checking to be consistent
        between|any|/|optional|? Unanimous yes

    |Provide operator bool for both Y: 6 N: 5 Provide .something() Y: 17
    N: 0 Provide =={} Y: 0 N: 5 Provide ==std::none Y: 5 N: 2
    something(any/optional) Y: 3 N: 8|


You can find the last version at [1].

The main part of P0032R0 was already reworked and included in the
post-Kona mailing P0032R1 [2]. You can find a reformatted version of [2]
at [3]. The proposal has chosen has_value as the name of the
..something() operation.

Any comment are welcome.

Vicente

[1]
https://github.com/viboes/std-make/blob/master/doc/proposal/nullable/P0196R0.md
[2] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0032r1.pdf
[3]
https://github.com/viboes/std-make/blob/master/doc/proposal/nullable/P0032R1.md

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-proposals/.

--------------010408070305070101010809
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>

    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <font size=3D"+1">Hi,<br>
      <br>
    </font><font size=3D"+1">I've extracted the none literal from P0032R0
      has requested in Kona. For those that are not aware of the
      proposal, here it is the abstract<br>
    </font><br>
    <blockquote>
      <p style=3D"-webkit-print-color-adjust: exact; margin: 15px 0px;
        color: rgb(0, 0, 0); font-family: Helvetica, arial, sans-serif;
        font-size: 14px; font-style: normal; font-variant: normal;
        font-weight: normal; letter-spacing: normal; orphans: auto;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: auto; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
        255);">In the same way we have<span
          class=3D"Apple-converted-space">=C2=A0</span><em
          style=3D"-webkit-print-color-adjust: exact;">NullablePointer</em>=
<span
          class=3D"Apple-converted-space">=C2=A0</span>types with<span
          class=3D"Apple-converted-space">=C2=A0</span><code
          style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
          padding: 0px 5px; white-space: nowrap; border: 1px solid
          rgb(234, 234, 234); background-color: rgb(248, 248, 248);
          border-top-left-radius: 3px; border-top-right-radius: 3px;
          border-bottom-right-radius: 3px; border-bottom-left-radius:
          3px;">nullptr</code><span class=3D"Apple-converted-space">=C2=A0<=
/span>to
        mean a null value, this proposal defines<span
          class=3D"Apple-converted-space">=C2=A0</span><em
          style=3D"-webkit-print-color-adjust: exact;">Nullable</em><span
          class=3D"Apple-converted-space">=C2=A0</span>requirements for typ=
es
        for which<span class=3D"Apple-converted-space">=C2=A0</span><code
          style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
          padding: 0px 5px; white-space: nowrap; border: 1px solid
          rgb(234, 234, 234); background-color: rgb(248, 248, 248);
          border-top-left-radius: 3px; border-top-right-radius: 3px;
          border-bottom-right-radius: 3px; border-bottom-left-radius:
          3px;">none</code><span class=3D"Apple-converted-space">=C2=A0</sp=
an>means
        the null value. This paper proposes a generic<span
          class=3D"Apple-converted-space">=C2=A0</span><code
          style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
          padding: 0px 5px; white-space: nowrap; border: 1px solid
          rgb(234, 234, 234); background-color: rgb(248, 248, 248);
          border-top-left-radius: 3px; border-top-right-radius: 3px;
          border-bottom-right-radius: 3px; border-bottom-left-radius:
          3px;">none</code><span class=3D"Apple-converted-space">=C2=A0</sp=
an>literal
        for<span class=3D"Apple-converted-space">=C2=A0</span><em
          style=3D"-webkit-print-color-adjust: exact;">Nullable</em><span
          class=3D"Apple-converted-space">=C2=A0</span>types like<span
          class=3D"Apple-converted-space">=C2=A0</span><code
          style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
          padding: 0px 5px; white-space: nowrap; border: 1px solid
          rgb(234, 234, 234); background-color: rgb(248, 248, 248);
          border-top-left-radius: 3px; border-top-right-radius: 3px;
          border-bottom-right-radius: 3px; border-bottom-left-radius:
          3px;">optional</code><span class=3D"Apple-converted-space">=C2=A0=
</span>and<span
          class=3D"Apple-converted-space">=C2=A0</span><code
          style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
          padding: 0px 5px; white-space: nowrap; border: 1px solid
          rgb(234, 234, 234); background-color: rgb(248, 248, 248);
          border-top-left-radius: 3px; border-top-right-radius: 3px;
          border-bottom-right-radius: 3px; border-bottom-left-radius:
          3px;">any</code><span class=3D"Apple-converted-space">=C2=A0</spa=
n>and
        proposes to replace the variant<span
          class=3D"Apple-converted-space">=C2=A0</span><code
          style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
          padding: 0px 5px; white-space: nowrap; border: 1px solid
          rgb(234, 234, 234); background-color: rgb(248, 248, 248);
          border-top-left-radius: 3px; border-top-right-radius: 3px;
          border-bottom-right-radius: 3px; border-bottom-left-radius:
          3px;">monostate_t</code><span class=3D"Apple-converted-space">=C2=
=A0</span>defined
        in<span class=3D"Apple-converted-space">=C2=A0</span><a
href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0088r0.pdf=
"
          title=3D"Variant: a type-safe union that is rarely invalid (v5)"
          style=3D"-webkit-print-color-adjust: exact; color: rgb(65, 131,
          196);">P0088R0</a><span class=3D"Apple-converted-space">=C2=A0</s=
pan>by<span
          class=3D"Apple-converted-space">=C2=A0</span><code
          style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
          padding: 0px 5px; white-space: nowrap; border: 1px solid
          rgb(234, 234, 234); background-color: rgb(248, 248, 248);
          border-top-left-radius: 3px; border-top-right-radius: 3px;
          border-bottom-right-radius: 3px; border-bottom-left-radius:
          3px;">none_t</code>.</p>
      <p style=3D"-webkit-print-color-adjust: exact; margin: 15px 0px;
        color: rgb(0, 0, 0); font-family: Helvetica, arial, sans-serif;
        font-size: 14px; font-style: normal; font-variant: normal;
        font-weight: normal; letter-spacing: normal; orphans: auto;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: auto; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
        255);">Note that for<span class=3D"Apple-converted-space">=C2=A0</s=
pan><em
          style=3D"-webkit-print-color-adjust: exact;">Nullable</em><span
          class=3D"Apple-converted-space">=C2=A0</span>types the null value
        doesn't mean an error, it is just a value different from all the
        other values, it is none of the other values.</p>
      <p style=3D"-webkit-print-color-adjust: exact; margin: 15px 0px;
        color: rgb(0, 0, 0); font-family: Helvetica, arial, sans-serif;
        font-size: 14px; font-style: normal; font-variant: normal;
        font-weight: normal; letter-spacing: normal; orphans: auto;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: auto; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
        255);">This takes in account the feedback from Kona meeting<span
          class=3D"Apple-converted-space">=C2=A0</span><a
href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0032r0.pdf=
"
          title=3D"Homogeneous interface for variant, any and optional"
          style=3D"-webkit-print-color-adjust: exact; color: rgb(65, 131,
          196);">P0032R0</a>. The direction of the committee was:</p>
      <ul style=3D"-webkit-print-color-adjust: exact; margin: 15px 0px;
        padding-left: 30px; color: rgb(0, 0, 0); font-family: Helvetica,
        arial, sans-serif; font-size: 14px; font-style: normal;
        font-variant: normal; font-weight: normal; letter-spacing:
        normal; orphans: auto; text-align: start; text-indent: 0px;
        text-transform: none; white-space: normal; widows: auto;
        word-spacing: 0px; -webkit-text-stroke-width: 0px;
        background-color: rgb(255, 255, 255);">
        <li style=3D"-webkit-print-color-adjust: exact; margin: 0px;">Do
          we want<span class=3D"Apple-converted-space">=C2=A0</span><code
            style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
            padding: 0px 5px; white-space: nowrap; border: 1px solid
            rgb(234, 234, 234); background-color: rgb(248, 248, 248);
            border-top-left-radius: 3px; border-top-right-radius: 3px;
            border-bottom-right-radius: 3px; border-bottom-left-radius:
            3px;">none_t</code><span class=3D"Apple-converted-space">=C2=A0=
</span>to
          be a separate paper?</li>
      </ul>
      <pre class=3D" language-none" style=3D"-webkit-print-color-adjust: ex=
act; margin: 0.5em 0px; background-color: rgb(245, 242, 240); border: 1px s=
olid rgb(204, 204, 204); font-size: 13px; line-height: 1.5; overflow: auto;=
 padding: 1em; border-top-left-radius: 3px; border-top-right-radius: 3px; b=
order-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(=
0, 0, 0); text-shadow: white 0px 1px; font-family: Consolas, Monaco, 'Andal=
e Mono', 'Ubuntu Mono', monospace; direction: ltr; text-align: left; white-=
space: pre; word-spacing: 0px; word-break: normal; word-wrap: normal; tab-s=
ize: 4; -webkit-hyphens: none; font-style: normal; font-variant: normal; fo=
nt-weight: normal; letter-spacing: normal; orphans: auto; text-indent: 0px;=
 text-transform: none; widows: auto; -webkit-text-stroke-width: 0px; backgr=
ound-position: initial initial; background-repeat: initial initial;"><code =
class=3D" language-none" style=3D"-webkit-print-color-adjust: exact; margin=
: 0px; padding: 0px; white-space
: pre; border: none; background-color: transparent; border-top-left-radius:=
 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border=
-bottom-left-radius: 3px; color: black; text-shadow: white 0px 1px; font-fa=
mily: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; direction:=
 ltr; text-align: left; word-spacing: normal; word-break: normal; word-wrap=
: normal; line-height: 1.5; tab-size: 4; -webkit-hyphens: none; background-=
position: initial initial; background-repeat: initial initial;">  SF F N A =
SA
  11 1 3 0 0</code></pre>
      <ul style=3D"-webkit-print-color-adjust: exact; margin: 15px 0px;
        padding-left: 30px; color: rgb(0, 0, 0); font-family: Helvetica,
        arial, sans-serif; font-size: 14px; font-style: normal;
        font-variant: normal; font-weight: normal; letter-spacing:
        normal; orphans: auto; text-align: start; text-indent: 0px;
        text-transform: none; white-space: normal; widows: auto;
        word-spacing: 0px; -webkit-text-stroke-width: 0px;
        background-color: rgb(255, 255, 255);">
        <li style=3D"-webkit-print-color-adjust: exact; margin: 0px;">
          <p style=3D"-webkit-print-color-adjust: exact; margin: 0px 0px
            15px;">Do we want the<span class=3D"Apple-converted-space">=C2=
=A0</span><code
              style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
              padding: 0px 5px; white-space: nowrap; border: 1px solid
              rgb(234, 234, 234); background-color: rgb(248, 248, 248);
              border-top-left-radius: 3px; border-top-right-radius: 3px;
              border-bottom-right-radius: 3px;
              border-bottom-left-radius: 3px;">operator bool</code><span
              class=3D"Apple-converted-space">=C2=A0</span>changes? No, ins=
tead
            a<span class=3D"Apple-converted-space">=C2=A0</span><code
              style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
              padding: 0px 5px; white-space: nowrap; border: 1px solid
              rgb(234, 234, 234); background-color: rgb(248, 248, 248);
              border-top-left-radius: 3px; border-top-right-radius: 3px;
              border-bottom-right-radius: 3px;
              border-bottom-left-radius: 3px;">.something()</code><span
              class=3D"Apple-converted-space">=C2=A0</span>member function
            (e.g.<span class=3D"Apple-converted-space">=C2=A0</span><code
              style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
              padding: 0px 5px; white-space: nowrap; border: 1px solid
              rgb(234, 234, 234); background-color: rgb(248, 248, 248);
              border-top-left-radius: 3px; border-top-right-radius: 3px;
              border-bottom-right-radius: 3px;
              border-bottom-left-radius: 3px;">has_value</code>) is
            preferred for the 3 classes. This doesn't mean yet that we
            replace the existing explicit<span
              class=3D"Apple-converted-space">=C2=A0</span><code
              style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
              padding: 0px 5px; white-space: nowrap; border: 1px solid
              rgb(234, 234, 234); background-color: rgb(248, 248, 248);
              border-top-left-radius: 3px; border-top-right-radius: 3px;
              border-bottom-right-radius: 3px;
              border-bottom-left-radius: 3px;">operator bool</code><span
              class=3D"Apple-converted-space">=C2=A0</span>in<span
              class=3D"Apple-converted-space">=C2=A0</span><code
              style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
              padding: 0px 5px; white-space: nowrap; border: 1px solid
              rgb(234, 234, 234); background-color: rgb(248, 248, 248);
              border-top-left-radius: 3px; border-top-right-radius: 3px;
              border-bottom-right-radius: 3px;
              border-bottom-left-radius: 3px;">optional</code>.</p>
        </li>
        <li style=3D"-webkit-print-color-adjust: exact; margin: 0px;">
          <p style=3D"-webkit-print-color-adjust: exact; margin: 0px 0px
            15px;">Do we want emptiness checking to be consistent
            between<span class=3D"Apple-converted-space">=C2=A0</span><code
              style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
              padding: 0px 5px; white-space: nowrap; border: 1px solid
              rgb(234, 234, 234); background-color: rgb(248, 248, 248);
              border-top-left-radius: 3px; border-top-right-radius: 3px;
              border-bottom-right-radius: 3px;
              border-bottom-left-radius: 3px;">any</code>/<code
              style=3D"-webkit-print-color-adjust: exact; margin: 0px 2px;
              padding: 0px 5px; white-space: nowrap; border: 1px solid
              rgb(234, 234, 234); background-color: rgb(248, 248, 248);
              border-top-left-radius: 3px; border-top-right-radius: 3px;
              border-bottom-right-radius: 3px;
              border-bottom-left-radius: 3px;">optional</code>?
            Unanimous yes</p>
        </li>
      </ul>
      <pre class=3D" language-none" style=3D"-webkit-print-color-adjust: ex=
act; margin: 0.5em 0px; background-color: rgb(245, 242, 240); border: 1px s=
olid rgb(204, 204, 204); font-size: 13px; line-height: 1.5; overflow: auto;=
 padding: 1em; border-top-left-radius: 3px; border-top-right-radius: 3px; b=
order-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: rgb(=
0, 0, 0); text-shadow: white 0px 1px; font-family: Consolas, Monaco, 'Andal=
e Mono', 'Ubuntu Mono', monospace; direction: ltr; text-align: left; white-=
space: pre; word-spacing: 0px; word-break: normal; word-wrap: normal; tab-s=
ize: 4; -webkit-hyphens: none; font-style: normal; font-variant: normal; fo=
nt-weight: normal; letter-spacing: normal; orphans: auto; text-indent: 0px;=
 text-transform: none; widows: auto; -webkit-text-stroke-width: 0px; backgr=
ound-position: initial initial; background-repeat: initial initial;"><code =
class=3D" language-none" style=3D"-webkit-print-color-adjust: exact; margin=
: 0px; padding: 0px; white-space
: pre; border: none; background-color: transparent; border-top-left-radius:=
 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border=
-bottom-left-radius: 3px; color: black; text-shadow: white 0px 1px; font-fa=
mily: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; direction:=
 ltr; text-align: left; word-spacing: normal; word-break: normal; word-wrap=
: normal; line-height: 1.5; tab-size: 4; -webkit-hyphens: none; background-=
position: initial initial; background-repeat: initial initial;">  Provide o=
perator bool for both  Y:  6 N: 5
  Provide .something()            Y: 17 N: 0
  Provide =3D=3D{}                    Y:  0 N: 5
  Provide =3D=3Dstd::none             Y:  5 N: 2
  something(any/optional)         Y:  3 N: 8</code></pre>
    </blockquote>
    <p style=3D"-webkit-print-color-adjust: exact; margin: 15px 0px;
      color: rgb(0, 0, 0); font-family: Helvetica, arial, sans-serif;
      font-size: 14px; font-style: normal; font-variant: normal;
      font-weight: normal; letter-spacing: normal; orphans: auto;
      text-align: start; text-indent: 0px; text-transform: none;
      white-space: normal; widows: auto; word-spacing: 0px;
      -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
      255);"><br>
    </p>
    <font size=3D"+1">You can find the last version at [1].<br>
      <br>
      The main part of </font><font size=3D"+1">P0032R0</font>=C2=A0 <font
      size=3D"+1">was already reworked and included in the post-Kona
      mailing </font><font size=3D"+1"><font size=3D"+1">P0032R1 </font>[2]=
..
      You can find a reformatted version of [2] at [3]. The proposal has
      chosen has_value as the name of the .something() operation.=C2=A0 <br=
>
      =C2=A0<br>
      Any comment are welcome.<br>
      <br>
    </font><font size=3D"+1"><font size=3D"+1">Vicente<br>
        <br>
      </font>[1] </font><font size=3D"+1"><font size=3D"+1"><a
          class=3D"moz-txt-link-freetext"
href=3D"https://github.com/viboes/std-make/blob/master/doc/proposal/reflect=
ion/P0197R0.md"><a class=3D"moz-txt-link-freetext" href=3D"https://github.c=
om/viboes/std-make/blob/master/doc/proposal/nullable/P0196R0.md">https://gi=
thub.com/viboes/std-make/blob/master/doc/proposal/nullable/P0196R0.md</a></=
a><br>
        [2]
        <a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.org/=
jtc1/sc22/wg21/docs/papers/2015/p0032r1.pdf">http://www.open-std.org/jtc1/s=
c22/wg21/docs/papers/2015/p0032r1.pdf</a><br>
      </font></font><font size=3D"+1"><font size=3D"+1">[3] </font></font><=
font
      size=3D"+1"><font size=3D"+1"><a class=3D"moz-txt-link-freetext"
href=3D"https://github.com/viboes/std-make/blob/master/doc/proposal/reflect=
ion/P0197R0.md">https://github.com/viboes/std-make/blob/master/doc/proposal=
/nullable/P0032R1.md</a><br>
        <br>
      </font></font>
  </body>
</html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />

--------------010408070305070101010809--

.