<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">On Jun 29, 2016, at 9:33 AM, David Sweeris <<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>> wrote:<br class=""><div><br class=""><blockquote type="cite" class="">Types where it makes sense, or types for which such semantics would be a good idea? Because, for example, you <i class="">could</i> do something like this:<br class=""><div class=""><div class=""><div class="" style="font-size: 12px; font-style: normal; font-variant-caps: 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-size-adjust: auto; -webkit-text-stroke-width: 0px; margin: 0px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">struct</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>HTMLParser :<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">IntegerLiteralConvertible</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>{</span></div><div class="" style="font-size: 12px; font-style: normal; font-variant-caps: 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; margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">init</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(integerLiteral value:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">IntegerLiteralType</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) {</span></div><div class="" style="font-size: 12px; font-style: normal; font-variant-caps: 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; margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <font color="#4f8187" class="">htmlMajorVersion</font></span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>= value</span></div><div class="" style="font-size: 12px; font-style: normal; font-variant-caps: 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-size-adjust: auto; -webkit-text-stroke-width: 0px; margin: 0px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> htmlMinorVersion</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>=<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">0</span></div><div class="" style="font-size: 12px; font-style: normal; font-variant-caps: 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; margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> }</span></div><div class="" style="font-size: 12px; font-style: normal; font-variant-caps: 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; margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">}</span></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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;">Back in the realm of math, I don’t think Sedenions — a 16-demensional (in the sense that complex numbers are 2-dimensional) number — have a well-defined division operator.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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;">As a more likely example, I don’t think it’d be too much of a stretch to attach integer literal semantics to matrices:</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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;"><div class="" style="margin: 0px; line-height: normal;"><div class="" style="font-family: Menlo; margin: 0px; line-height: normal; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>x:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">Matrix</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>=<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">1</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">// Sets diagonal to 1</span></div><div class="">Matrices don’t have a division operator, and you can’t do<span class="Apple-converted-space"> </span><i class="">any</i><span class="Apple-converted-space"> </span>of the `Arithmetic` functions to two matrices without first checking their dimensions.</div></div></div></div></div></blockquote><div><br class=""></div><div>There is at least an argument to be made that *division* doesn’t belong. I think most people's common-sense notion of being “numbery” lies somewhere between a ring and a field (but probably doesn’t include the Sedenions, which aren’t associative).</div><div><br class=""></div><div>That said, there are certainly some practical considerations in favor of including division in Arithmetic.</div><div><br class=""></div><div>I think matrix dimension mismatches (for variably-dimensioned types) are best handled via precondition; the operator exists, but will trap if they don’t match.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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;"><div class="" style="margin: 0px; line-height: normal;"><div class=""> Plus, inherently-dimensioned matrix types:</div><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><div class="" style="margin: 0px; line-height: normal;"><div class="" style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">var</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>x =<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">Matrix</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">_2</span><span class="" style="font-variant-ligatures: no-common-ligatures;">,</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">_3</span><span class="" style="font-variant-ligatures: no-common-ligatures;">>()<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">// "_2" and "_3" are dummy types</span></div></div></div></div><div class=""><i class="">can’t</i><span class="Apple-converted-space"> </span>implement `*`, unless their two dimensions happen to be equal — "<span class="" style="font-family: Menlo; color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;">Matrix</span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;"><</span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;"><font color="#272ad8" class="">2</font></span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;">,</span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;"><font color="#272ad8" class="">3</font></span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;">>() * </span><span class="" style="font-family: Menlo; color: rgb(112, 61, 170); font-variant-ligatures: no-common-ligatures;">Matrix</span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;"><</span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;"><font color="#272ad8" class="">2</font></span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;">,</span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;"><font color="#272ad8" class="">3</font></span><span class="" style="font-family: Menlo; font-variant-ligatures: no-common-ligatures;">>()</span>” doesn’t have a valid definition.</div></div></div></div></div></blockquote></div><br class=""><div class="">I’m not sure it makes sense to have scalar initializers or literals for non-square matrices, since you don't have 1*x = x.</div><div class=""><br class=""></div><div class="">We’re a little bit off in the weeds here =)</div></body></html>