[racket] Type-class-like idiom in Racket?

From: Helmut Rohrbacher (helmut.rohrbacher at gmail.com)
Date: Mon Mar 5 15:17:19 EST 2012

Sorry if this double posts.

I just wanna say, as a new member, I'm impressed by the speed, volume, and
quality of responses in this community. Not being simply told to RTFM or
such is a really great change from many other places.



> Or use structure properties to turn them into sequences (and then use for
and
> friends).



That would work for the TO-LIST abstraction or for using a sequence as an
intermediate representation for collection types. But, what about something
like the Speakable behaviorial type?



> I imagine that one could use impersonators for vectors and _mutable_
lists.



Racket's a pretty big language. I think everytime I try and do something, I
end up in a new unexplored corner of the language. I'll check impersonators
out, though according to Sam's comment they won't necessarily work.



> You could do that, or you could handle them specially in your generic

> function.



That's probably the most straight forward way, but it means dealing with
built-in types upfront rather than allowing for later extensibility (unless
I missed something).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120305/36da682e/attachment.html>

Posted on the users mailing list.