On Aug 25, 11:27 am, Stuart Halloway <[EMAIL PROTECTED]>
wrote:
> > It's a bit apples and oranges emulating pattern matching and case
> > classes with multimethods, but very illustrative. It's important to
> > note that the Scala code is using type tags, not values, in doing the
> > match, so I think using tags rather than looking for non-zero values
> > is more similar:
>
> You're stealing my thunder.
Sorry, that wasn't my intent.
> Using a type tag would be more similar,
> but would introduce what I consider to be a bug in the Scala version:
> (red 10) is not the same as (struct color 10 0 0).
>
Ah, ok - well, take whatever you will from the my example, I guess I
really didn't get the original Scala example's purpose.
> > A critical difference, IMO, is that pattern matches are closed, and
> > multimethods are open:
>
> With Scala extractors, pattern matches can be open too.
Interesting. By that do you mean an existing match can work with
subsequently-defined types or that new 'cases' can effectively be
added later? Do you have a pointer to an example of the latter?
Rich
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---