<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">E-mail from Jeremy Siek about "open" objects.<div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div>Kim</div><div><br></div></span><br class="Apple-interchange-newline">
</div>
<div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Jeremy Siek <<a href="mailto:jsiek@indiana.edu">jsiek@indiana.edu</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>Re: gradual typing and objects</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">July 29, 2013 6:50:40 PM PDT<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Kim Bruce <<a href="mailto:kim@cs.pomona.edu">kim@cs.pomona.edu</a>><br></span></div><br><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 29, 2013, at 5:30 PM, Kim Bruce <<a href="mailto:kim@cs.pomona.edu">kim@cs.pomona.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks for your quick reply.<br><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><blockquote type="cite">One of the issues we've been struggling with has to do with abstract classes or objects. Suppose an object definition invokes a method m (e.g., by self.m) when no method m occurs in the class or any of its subclasses. The dynamic typing afficionados among us want that to work fine (perhaps emitting a warning, but certainly not an error that halts computation). The key seems to be whether one should treat the type of self as "dynamic" or, as you do, as an object type with the methods listed in the object. (In either case the type is implicit, as there is typically no place to write it down -- though we do have a slot for classes.) In any case we want to be able to define abstract classes and objects, but we are in some disagreement about how to do that.<br><br></blockquote><blockquote type="cite">If you've had any experience with the version where self has implicit type dynamic, I'd be very interested in your views.<br><br></blockquote><br></div><div>I'm thinking that you'd want to let the programmer choose the type for self on a per-method basis… unlike in our ECOOP paper.</div><div>For a Python-like language, or Abadi-Cardelli-style calculus, where self is an explicit parameter, this is easy.</div><div>If self is not an explicit parameter, then figuring out syntax for this gets tricky…</div></div></blockquote><div><br></div>I suspect we'd like to avoid this. Self is not an explicit parameters, and even if it were, the notational overhead would be large.<br></div></div></blockquote><div><br></div><div>To reduce notational overhead, there's the option of specifying the self type once per class or object definition instead</div><div>of per method.</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>But once the type for self is specified for a method, then the type checking of the method body should fall out according</div><div>to the normal typing rules for the dynamic type and for object types.</div><div><br></div><div>Perhaps I should mention one thing that we're looking at beyond what was in the ECOOP paper.</div><div>In the ECOOP object types were "closed" in that one cannot call a method if it isn't listed in the object type</div><div>without getting a compile-time error. Since then we've thought about having "open" object types as well, that</div><div>would allow calling methods not listed in the type.</div></div></blockquote><div><br></div>This is exactly what some people have been pushing for. I'd be interested in knowing what that might look like.</div><div><br></div></div></blockquote><div><br></div><div>Ok, so there'd be an open object type that's syntactically distinguished from closed object types, perhaps </div><div>using two dots:</div><div><br></div><div>T ::= [ l_i : T_i ^{i \in 1..n} ] closed</div><div> | [ l_i : T_i ^{i \in 1..n} ..] open</div><div><br></div><div>Then the invoke rules for open objects would look like</div><div>the following in an Abadi-Cardelli style object calculus</div><div><br></div><div>G |- e : [ l_i : T_i ^{i \in 1..n} ..] j \notin {1..n}</div><div>--------------------------------------------------------------</div><div> G |- e.l_j : Dyn</div><div><br></div><div>and</div><div><div><br></div><div>G |- e : [ l_i : T_i ^{i \in 1..n} ..] j \in {1..n}</div><div>--------------------------------------------------------------</div><div> G |- e.l_j : T_j</div></div><div><br></div><div>In the first situation above, their would been a run-time</div><div>check regarding whether the l_j method is present and the return value</div><div>would need to be cast to Dyn.</div><div><br></div><div>Cheers,</div><div>Jeremy</div><div><br></div><div><br></div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Kim<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I'd be happy to discuss any of this in more detail!</div><div><br></div><div>Cheers,</div><div>Jeremy</div><br><br><div apple-content-edited="true">
<div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>_______________________________</div><div>Jeremy G. Siek <<a href="mailto:jsiek@indiana.edu">jsiek@indiana.edu</a>></div><div>Associate Professor</div><div>School of Informatics and Computing</div><div>Indiana University Bloomington</div><div><a href="http://homes.soic.indiana.edu/jsiek/">http://homes.soic.indiana.edu/jsiek/</a></div><div><br></div></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></blockquote></div><br></div></blockquote></div><br><div apple-content-edited="true">
<div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>_______________________________</div><div>Jeremy G. Siek <<a href="mailto:jsiek@indiana.edu">jsiek@indiana.edu</a>></div><div>Associate Professor</div><div>School of Informatics and Computing</div><div>Indiana University Bloomington</div><div><a href="http://homes.soic.indiana.edu/jsiek/">http://homes.soic.indiana.edu/jsiek/</a></div><div><br></div></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></blockquote></div><br></div></body></html>