3 ms·
The explicit tail calls look pretty neat. All languages should include this, or something like it, I think; tail calls come in handy for all sorts of things. Ma
by to3m 14y ago
The explicit tail calls look pretty neat. All languages should include this, or something like it, I think; tail calls come in handy for all sorts of things. Making it explicit sidesteps complaints about how it will impede debugging, and ensures programmers will definitely get it where they want/expect.
I think this would be a chance to rehabilitate the much-maligned GOTO keyword. But "tailcall" is probably just as good.
- michaelhoffman 14y agoPython language creator Guido von Rossum prevents CPython from having tail call optimization because he doesn't want people to use it. http://neopythonic.blogspot.com/2009/04/tail-recursion-elimination.html http://neopythonic.blogspot.com/2009/04/tail-recursion-elimi...
- sigzero 14y agoHis choice, he is the BDFL after all.
- yfyf 14y agoI wonder if he would claim the same argument today as he does in this[1] comment, in particular the paragraph "On side effects being bad <..>". I would dare to claim that there's some trend to do things more side-effectlessly not only in programming, but also in general, people in IT are finally realizing* that the more isolated, light-weight and modular things are (think of increased interest in functional programming (pure functions), dominance of cloud-based/inspired solutions (spinning up small instances of VMs)) the better. Somehow this particular mindset helps at all levels. Hah, there's actually a term for what I'm trying to describe: Shared nothing architecture[2]. Allowing side-effects on any level implies "sharing" to me. [*]: of course you could say "this has always been the case", but somehow some years ago Java and the friends seemed like the only "enterprise level" solution to most businesses and the general fat-stack+vertical-scaling seemed somewhat reasonable. [1]: http://neopythonic.blogspot.nl/2009/04/tail-recursion-elimination.html?showComment=1240451280000#c1726520516547497765 http://neopythonic.blogspot.nl/2009/04/tail-recursion-elimin... [2]: http://en.wikipedia.org/wiki/Shared_nothing_architecture http://en.wikipedia.org/wiki/Shared_nothing_architecture
- mahmud 14y agoI don't think the world of software development changed at all since 2009. It takes about 15 years to see noticable shifts in practices. Also, shared-nothing "architecture" goes back to the 60s with the first investigations into concurrency. In fact, if I were being pedantic, I would say it predates computing itself: logic is all side-effect free.
- yfyf 14y agoSure, theoretical investigations on things begin many years earlier than anyone starts actually using them, but somehow "concurrency" wasn't something available to your everyday Joe back in 60s, right? Multi-core wasn't the norm, there was no elastic cloud, what so on. And I am not really claiming that software development changed much in 3 years, but I think people's mindsets are changing faster than that, especially of those who are actively involved in thinking about these things.
- mahmud 14y agoFair point.
- lolcraft 14y agoWell, to be trollish :), he also didn't want it because: 1 - With TCO, there would be no more "recursiveFunction recursiveFunction recursiveFunction" x 1000 stack traces. Which apparently is bad. Might force someone to use a debugger, you know. 2 - Non-standard Python implementers won't be competent enough to code it, so it's best he doesn't force them to. 3 - He doesn't believe in recursion. He doesn't like it. I mean, the look of it. It's too nerdy. 4 - He made a bad choice in basing his language in dynamic binding. He recognises it, says it's horrible style, un-pythonic, but won't make it go away because users, users, yadda yadda. All this from someone whose job description is BDFL ;) Yeah, I'm bitter about some minor quirk no one cares about, but... you know, I might have preferred a "I can't be arsed to do it" answer. Those arguments are pretty laughable.
- xnxn 14y agoI clicked that link ready to laugh, but he makes a persuasive argument. I feel like I've been tricked.
- btilly 14y agoI think this would be a chance to rehabilitate the much-maligned GOTO keyword. Perl has used "goto &foo" for that exact purpose for ages. It just became yet another random feature that experts know about, regular programmers ignore, and critics use to show how terrible the language is.
- draegtun 14y agoAnd there are a few CPAN modules for those who are squeamish about using goto :) - https://metacpan.org/module/Sub::Call::Tail https://metacpan.org/module/Sub::Call::Tail - https://metacpan.org/module/Sub::Call::Recur https://metacpan.org/module/Sub::Call::Recur