On 4/4/11 6:41 PM, Stefan Monnier wrote: >> Polymorphism-via-typecase is delicate at best no matter what language we're >> working in. > > [ Irrelevant side-comment: Completely depends on the problem at hand: it > makes adding "methods" much easier. ] IMHO, those situations are the exceptions. >>>> So we will have to make almost all values a struct anyway to fix bugs >>>> like this. >>> Yes, all new types will use register structs. That's not a problem. >>> And you can even later-on de-support old types and have them go through >>> register structs as well. >> What's wrong with getting it over with now? > > It's the difference between "one simple obviously correct change" and > "one big change that might be correct". I see your point, though both approaches would be pretty small changes in the scheme of things. If you want to split the change into smaller steps, that's fine so long as we eventually aim to get rid of the typecase polymorphism. >> I'd also slightly prefer Leo's structure approach to the >> dispatcher-function one below. > > I tend to agree, tho both kind of suck: we'd want real objects with > dynamic dispatch instead. Well, there's EIEIO. It gives you the ability to easily add methods while not baking the dispatch into each one. On the other hand, it's a quite a bit of code to pull into the core at runtime.