|
|
Subscribe / Log in / New account

Kawa — fast scripting on the Java platform

Kawa — fast scripting on the Java platform

Posted Dec 4, 2014 12:10 UTC (Thu) by peter-b (guest, #66996)
In reply to: Kawa — fast scripting on the Java platform by ms
Parent article: Kawa — fast scripting on the Java platform

> 1. Tail calls are actually essential for object oriented languages too

They're not essential, but they are highly beneficial. :-) If proper tail call optimisation (PTC) was *required* for object oriented language implementations, then Python would have to provide PTC. The fact that Python doesn't is disproof by contradiction of the requirement, I think.

> 2. Scala does TCO for recursive functions

Yes; self-calls in the tail position can be optimised by the JVM (actually this is quite a trivial optimisation), but Scheme requires PTC. This enables a variety of very useful control structure-like syntax to be defined using Scheme's hygienic macro system.

> 3. For some reason I thought TCO was going to be in Java 8 but I now can't find any evidence for that.

I haven't really been keeping track of it; I'm not too keen on Java programming and I looked into Scala/Clojure a few years ago but decided my time was better spent playing with Guile Scheme instead!


to post comments

Kawa — fast scripting on the Java platform

Posted Dec 4, 2014 12:22 UTC (Thu) by ms (subscriber, #41272) [Link]

> > 1. Tail calls are actually essential for object oriented languages too
> They're not essential, but they are highly beneficial. :-) If proper tail call optimisation (PTC) was *required* for object oriented language implementations, then Python would have to provide PTC. The fact that Python doesn't is disproof by contradiction of the requirement, I think.

My reading is that without tail calls, you are necessarily forced to break various abstraction, encapsulation and delegation core principles of OO. To what extent that means OO languages without tail calls are not "proper" OO languages is of course debatable. However, I have a personal bias against OO generally and have no intention of trolling so I'll stop here.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds