<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">Some corrections on my previous post:</p>
<ol style="margin:1.2em 0px;padding-left:2em">
<li style="margin:0.5em 0px"><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)">class var sharedInstance</code> won’t work because of dynamically created types<ul style="margin:1.2em 0px;padding-left:2em;margin:0px;padding-left:1em">
<li style="margin:0.5em 0px">We’ll still need a global set. Otherwise, the idea remains the same</li>
<li style="margin:0.5em 0px">The global set will be of type <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)">Set<_Type<Any>></code></li>
</ul>
</li>
<li style="margin:0.5em 0px">Advantages of nested <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>:<ul style="margin:1.2em 0px;padding-left:2em;margin:0px;padding-left:1em">
<li style="margin:0.5em 0px"><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> can have all kinds of initializers without losing uniqueness</li>
<li style="margin:0.5em 0px">Usage of a <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)">final class</code> is an implementation detail. We just need reference semantics from it</li>
</ul>
</li>
<li style="margin:0.5em 0px">In my “builder” example:<ul style="margin:1.2em 0px;padding-left:2em;margin:0px;padding-left:1em">
<li style="margin:0.5em 0px"><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)">var builder</code></li>
<li style="margin:0.5em 0px"><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)">name: "Age"</code></li>
</ul>
</li>
</ol>
<div title="MDH:PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPlNvbWUgY29ycmVjdGlvbnMgb24gbXkgcHJldmlvdXMg
cG9zdDo8L2Rpdj48ZGl2IGNsYXNzPSJnbWFpbF9leHRyYSI+PGJyPjwvZGl2PjxkaXYgY2xhc3M9
ImdtYWlsX2V4dHJhIj4xLiBgY2xhc3MgdmFyIHNoYXJlZEluc3RhbmNlYCB3b24ndCB3b3JrIGJl
Y2F1c2Ugb2YgZHluYW1pY2FsbHkgY3JlYXRlZCB0eXBlczwvZGl2PjxkaXYgY2xhc3M9ImdtYWls
X2V4dHJhIj4mbmJzcDsgKiBXZSdsbCBzdGlsbCBuZWVkIGEgZ2xvYmFsIHNldC4gT3RoZXJ3aXNl
LCB0aGUgaWRlYSByZW1haW5zIHRoZSBzYW1lPC9kaXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEi
PiZuYnNwOyAqIFRoZSBnbG9iYWwgc2V0IHdpbGwgYmUgb2YgdHlwZSBgU2V0Jmx0O19UeXBlJmx0
O0FueSZndDsmZ3Q7YDwvZGl2PjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIj4yLiBBZHZhbnRhZ2Vz
IG9mIG5lc3RlZCBgX1R5cGUmbHQ7VCZndDtgOjxicj48L2Rpdj48ZGl2IGNsYXNzPSJnbWFpbF9l
eHRyYSI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