[racket] Racket v5.3
Very close to some sort of "Type Classes" for structures if
a) Ability to define and label a set of typed generic methods.
b) Declare a structure as satisfying a given set of typed generic methods.
c) TR verify said satisfaction.
I've successfully attached a TR typed writer method to a struct:'s #methods
gen:custom-write for example.
On Tue, Aug 14, 2012 at 10:17 AM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:
> On 2012-08-13 13:28:07 -0700, Jordan Johnson wrote:
> > I'm curious: what use cases call for the new generics as opposed to
> > the old class & interface system? I'm trying to get a clearer picture
> > of the motivation for the new functionality, and the differences
> > between old-style class-based OO code and this struct-based kind.
>
> This feature isn't intended to replace class-based OO code. Notably,
> these generics don't have inheritance, overriding, mixins, and other
> "heavyweight" features that you might use with the class system.
>
> Instead, racket/generic is intended to replace the use of struct type
> properties as a mechanism to add generic behavior to datatypes. Before
> this library, generic functions like `dict-ref` or `stream-first` relied
> on ad-hoc protocols where a struct would provide a collection of
> functions to implement dictionary operations.
>
> Now we provide a unified and consistent way to define such generic
> functions and implement their behavior on specific instances.
>
> Cheers,
> Asumu
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120814/fec35570/attachment.html>