<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;"><br><div><div>On 7 Feb 2014, at 14:00, 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;">What is the definition of Collection in your example? Your definition in collections.grace in GUnit looks different:<div><br></div></div></blockquote><br></div><div>Let’s assume something like</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>type Collection<E> = { add(element: E) -> Collection<E>; remove(element: E) -> Collection<E>; … }</div><div><br></div><div>I was seeing two issues. One is insisting that the type parameters are uniform:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>type IndexableCollection = Collection<E> & type { at(ix:Number) -> E; at(ix:Number) put(e:E) }</div><div><br></div><div>clearly doesn’t work, because the E is unbound, but on reflection, I think that </div><br><div><span class="Apple-tab-span" style="white-space: pre;"> </span>type IndexableCollection<E> = Collection<E> & type { at(ix:Number) -> E; at(ix:Number) put(e:E) }</div><div><br></div><div>would work OK. </div><div><br></div><div>The other is that the operations in IndexableCollection need to return an IndexableCollection, not a Collection. That’s what I was meaning by SelfType. We have to “tie the fixpoint knot” <i>after</i> we have done the &, not before, to get the right type. </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Andrew</div><div><br></div></body></html>