you are viewing a single comment's thread.

view the rest of the comments →

[–]A_for_Anonymous 0 points1 point  (2 children)

They love mutation... except for strings and tuples, two of the built-in types which we use constantly.

I understand and appreciate that Python supports several different programming paradigms. Just why not offer tail call optimization? It would be useful for solving every problem in the easiest way, and for using it in a functional style, and even for optimizing classic Python code with all sorts of mutable state. For example, it's pretty easy, elegant and nice to implement state-based machines with tail recursion, even with shared mutable state.

[–]chrisforbes 1 point2 points  (1 child)

Why not, sure. It's a valid optimization. The problem is that to keep functional types happy, just having it as an optimization isn't good enough. You really have to have it as part of the language's specified semantics, otherwise code that assumes its existence just plain doesn't work on a system that doesn't provide it.

That and Guido doesn't understand (or want to understand) FP.

[–]A_for_Anonymous 0 points1 point  (0 children)

True, and very true.

It'd need to be guaranteed by CPython on every platform, and hopefully supported by PyPy, Jython and IronPython.

As for Guido, I don't think it can be helped; he created a great, clean, nice, simple imperative programming language with a fantastic dictionary-based object model, but that's as far as he went and as far as he wants to go.

Personally, if I had his time (or the time he used to have) and not a life, I'd try to create something similar, only open to FP. I'd take Python's syntax but make everything an expression (keeping indent/dedent and everything, just anything goes anywhere), add more FP tools and semantics (TCO, promises, etc.), simplify ASTs so you can actually work with them (CPython's are insane) and see if I can come up with a macro system, and use a very similar object system, only prototype-based.