Very close to some sort of "Type Classes" for structures if <div>a) Ability to define and label a set of typed generic methods.<div>b) Declare a structure as satisfying a given set of typed generic methods.</div>
<div>c) TR verify said satisfaction.</div><div><br></div><div>I've successfully attached a TR typed writer method to a struct:'s #methods gen:custom-write for example.<br><br><div class="gmail_quote">On Tue, Aug 14, 2012 at 10:17 AM, Asumu Takikawa <span dir="ltr"><<a href="mailto:asumu@ccs.neu.edu" target="_blank">asumu@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2012-08-13 13:28:07 -0700, Jordan Johnson wrote:<br>
> I'm curious: what use cases call for the new generics as opposed to<br>
> the old class & interface system? I'm trying to get a clearer picture<br>
> of the motivation for the new functionality, and the differences<br>
> between old-style class-based OO code and this struct-based kind.<br>
<br>
</div>This feature isn't intended to replace class-based OO code. Notably,<br>
these generics don't have inheritance, overriding, mixins, and other<br>
"heavyweight" features that you might use with the class system.<br>
<br>
Instead, racket/generic is intended to replace the use of struct type<br>
properties as a mechanism to add generic behavior to datatypes. Before<br>
this library, generic functions like `dict-ref` or `stream-first` relied<br>
on ad-hoc protocols where a struct would provide a collection of<br>
functions to implement dictionary operations.<br>
<br>
Now we provide a unified and consistent way to define such generic<br>
functions and implement their behavior on specific instances.<br>
<br>
Cheers,<br>
Asumu<br>
<div class="HOEnZb"><div class="h5">____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br></div></div>