Re: Python 3000 - Adaptation or Generic Functions?
Posted: Apr 7, 2006 2:47 PM
> > there's even something like a
> > future for Dylan.
> I won't be part of it.
I'd be surprised if you were. You have a successful, living language, after all.
> > Nice to see that Python is getting support for Generic
> > Functions. Now if you add macros for support of
> > metasyntactic abstractions, get rid of fundamental
> > ("non-object") types for orthogonality, add type
> > annotations and optimistic type inferencing for
> > performance, you'll end up with a language that pretty
> > much looks like Dylan, but with a bigger user base.
> Tong firmly in cheek I hope?
Well, I'm dead serious about being glad that the Python community considers generic functions. They are a powerful concept after all, and I think a much more natural way to approach object-oriented design. It should be already obvious by looking at a trivial example like
a + b. Talking about + being a function of the type of
a, like you would in the single dispatch model, just isn't as natural as thinking about the generic function
+, which has a method for adding a specific combination of the types of both
b. Additionally, to get the kind of decoupling you need for extensibility you need to implement the Visitor pattern, which is just additional work.
So since Python is among the languages I do use, and consider one of the saner languages out there, and since I do like generic functions, I'd be happy to see them in.
The comment about Python becoming like Dylan is entirely tongue-in-cheek, of course. But sometimes I wish Python had more of the powerful features I've become accustomed to, or Dylan had the user base to come up with such well-polished implementations and wide range of maintained libraries.
With PyPy, Python has become a serious language to keep on the radar. I'm curious to see whether it will be possible to close the performance gap.
Oh, by the way, I missed separation of non-local exits, stack unwind protect mechanisms and exception handlers in my wishlist of features above. It's so much nicer to be able to handle conditions before the stack is unwound, because it allows recovery.
> > Which isn't a big surprise, given that both Python and
> > Dylan are based on Scheme, just with a different
> I consider that an insult.
Oh, it wasn't meant to be, and if that insulted you, I apologize. I meant to say that the semantic distance between those languages is small, compared to, say, ML, C++ or Prolog. There are more good ideas to steal from that camp than just generic functions.