[racket-dev] Generics updates

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Fri Aug 2 15:33:02 EDT 2013

On Fri, Aug 2, 2013 at 1:47 PM, Stephen Chang <stchang at ccs.neu.edu> wrote:

> > With that in mind, I think it would make sense to move `set-first' and
> > `set-empty?' to the primitive set (making it clear that they are
> > optional, and can be derived from `set->stream' if need be). With those
> > two in the primitive set, anything that implements all the primitives
> > should get all the derived for free, right?
>
> Oh yeah, I like that better than moving set->stream to primitives
> since they are more "standard" set operations.
>

So the proposal for "primitive" methods is to pick one canonical set of
methods from which all the others can be derived?  I'm fairly sure there's
more than one such set, and I'm not sure there's one choice that's clearly
better than the others. I can understand the benefits of documenting a
"suggested" set, but given that it is an arbitrary and pragmatic
distinction, I'm not sure I'd want to set them off in a section any more.
I'd just make a list in the gen:set description or something.

Carl, I dont see how guaranteeing some fallback implementations
> affects allowing more efficient versions. I think most programmers
> understand that the default implementation is probably not very
> efficient.
>

Yes, but a default implementation doesn't have to be inefficient.  Right
now the fallback implementation of set=? and proper-subset? will be
efficient if the implementation of subset? is efficient.  Your proposal to
make fallbacks depend only on primitive methods would prevent that.  I
don't understand why we'd want to prevent "intelligent" fallbacks like I've
made the effort to write, just to draw a line in the sand.

--Carl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20130802/d9445049/attachment.html>

Posted on the dev mailing list.