> 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. 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). > A critical difference, IMO, is that pattern matches are closed, and > multimethods are open: With Scala extractors, pattern matches can be open too. That said, I find that writing the extractors to be syntactic vinegar compared to multimethods. But Scala is a big beast, and I won't be surprised if I find some tricks that make writing the extractors easier. Stuart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---