<html><head><style>
body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        padding:1em;
        margin:auto;
        background:#fefefe;
}
h1, h2, h3, h4, h5, h6 {
        font-weight: bold;
}
h1 {
        color: #000000;
        font-size: 28pt;
}
h2 {
        border-bottom: 1px solid #CCCCCC;
        color: #000000;
        font-size: 24px;
}
h3 {
        font-size: 18px;
}
h4 {
        font-size: 16px;
}
h5 {
        font-size: 14px;
}
h6 {
        color: #777777;
        background-color: inherit;
        font-size: 14px;
}
hr {
        height: 0.2em;
        border: 0;
        color: #CCCCCC;
        background-color: #CCCCCC;
display: inherit;
}
p, blockquote, ul, ol, dl, li, table, pre {
        margin: 15px 0;
}
a, a:visited {
        color: #4183C4;
        background-color: inherit;
        text-decoration: none;
}
#message {
        border-radius: 6px;
        border: 1px solid #ccc;
        display:block;
        width:100%;
        height:60px;
        margin:6px 0px;
}
button, #ws {
        font-size: 12 pt;
        padding: 4px 6px;
        border-radius: 5px;
        border: 1px solid #bbb;
        background-color: #eee;
}
code, pre, #ws, #message {
        font-family: Monaco;
        font-size: 10pt;
        border-radius: 3px;
        background-color: #F8F8F8;
        color: inherit;
}
code {
        border: 1px solid #EAEAEA;
        margin: 0 2px;
        padding: 0 5px;
}
pre {
        border: 1px solid #CCCCCC;
        overflow: auto;
        padding: 4px 8px;
}
pre > code {
        border: 0;
        margin: 0;
        padding: 0;
}
#ws { background-color: #f8f8f8; }
.bloop_markdown table {
border-collapse: collapse;
font-family: Helvetica, arial, freesans, clean, sans-serif;
color: rgb(51, 51, 51);
font-size: 15px; line-height: 25px;
padding: 0; }
.bloop_markdown table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
.bloop_markdown table tr:nth-child(2n) {
background-color: #f8f8f8; }
.bloop_markdown table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
.bloop_markdown table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
.bloop_markdown table tr th :first-child, table tr td :first-child {
margin-top: 0; }
.bloop_markdown table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }
.bloop_markdown blockquote{
border-left: 4px solid #dddddd;
padding: 0 15px;
color: #777777; }
blockquote > :first-child {
margin-top: 0; }
blockquote > :last-child {
margin-bottom: 0; }
code, pre, #ws, #message {
word-break: normal;
word-wrap: normal;
}
hr {
display: inherit;
}
.bloop_markdown :first-child {
-webkit-margin-before: 0;
}
code, pre, #ws, #message {
font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
}
.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="bloop_markdown"><p>I haven’t noticed the difference between those to at first glance.</p>
<p>Okay but do we need public initializer at all?</p>
<p>I’d put this into the alternative section so the core team can decide how to implement it (if this gets accepted).</p>
<p>I’ll prepare a second implementation gist for this suggestion. Feel free to update the proposal for both versions. (I see what you meant - COW optimized type like Foundation types.)</p>
<p>I’m to tired right now, I’ll do it tomorrow. It seems that we’re almost there. Maybe we can PR tomorrow so the review will kick off ASAP.</p>
<p></p></div><div class="bloop_original_html"><style>body{font-family:Helvetica,Arial;font-size:13px}</style><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <br> <div id="bloop_sign_1468612409794312960" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br><p class="airmail_on">Am 15. Juli 2016 um 21:49:29, Anton Zhilin (<a href="mailto:antonyzhilin@gmail.com">antonyzhilin@gmail.com</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>
<title></title>
<div dir="ltr">
<div class="markdown-here-wrapper" style="">
<p style="margin:0px 0px 1.2em!important">I suggested it because
now we can’t call any initializers on <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">
Type<T></code>. If we add <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">
_Type<T></code>, we can add public initializers and keep
<code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">
Type<T></code> instances unique.</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="hljs language-swift" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248);white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// No uniqueness guarantee</span>
internal final <span class="hljs-class"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">class</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">_Type</span><<span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">T</span>> </span>{
<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">var</span> _metatype: <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Metatype</span><<span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">T</span>>
<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">init</span>()
<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">init</span>(<span class="hljs-number" style="color:rgb(0,128,128)">_</span>: <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">AnyMetatype</span>)
<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">init</span>?<<span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">U</span>>(casting: <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Type</span><<span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">U</span>>)
}
internal <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">var</span> _typeStorage = <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Set</span><_Type<<span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Any</span>>>()
<span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// Uniqueness guarantee</span>
<span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// 'final class' is an implementation detail</span>
public <span class="hljs-class"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">struct</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">Type</span><<span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">T</span>> </span>{
internal <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">var</span> _impl: _Type<<span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">T</span>>
<span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// Notice 'public'</span>
public <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">init</span>()
public <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">init</span>(<span class="hljs-number" style="color:rgb(0,128,128)">_</span>: <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">AnyMetatype</span>)
public <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">init</span>?<<span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">U</span>>(casting: <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Type</span><<span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">U</span>>)
}
</code></pre>
<p style="margin:0px 0px 1.2em!important">There will be no
<code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">
===</code> operator for <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">
Type<T></code>, because it does not add value. <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">
Type<T></code> is a wrapper of typeless identifier with value
semantics. It is singleton pattern that makes us use classes.</p>
<div title="MDH:PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPkkgc3VnZ2VzdGVkIGl0IGJlY2F1c2Ugbm93IHdlIGNh bid0IGNhbGwgYW55IGluaXRpYWxpemVycyBvbiBgVHlwZSZsdDtUJmd0O2AuIElmIHdlIGFkZCBg X1R5cGUmbHQ7VCZndDtgLCB3ZSBjYW4gYWRkIHB1YmxpYyBpbml0aWFsaXplcnMgYW5kIGtlZXAg YFR5cGUmbHQ7VCZndDtgIGluc3RhbmNlcyB1bmlxdWUuPC9kaXY+PGRpdiBjbGFzcz0iZ21haWxf ZXh0cmEiPjxicj48L2Rpdj48ZGl2IGNsYXNzPSJnbWFpbF9leHRyYSI+YGBgc3dpZnQ8L2Rpdj48 ZGl2IGNsYXNzPSJnbWFpbF9leHRyYSI+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPi8vIE5vIHVu aXF1ZW5lc3MgZ3VhcmFudGVlPC9kaXY+PGRpdiBj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blockquote></div><div class="bloop_markdown"><p></p></div></body></html>