[MacRuby-devel] [MacRuby] #528: Improve Tail Call Elimination
MacRuby
ruby-noreply at macosforge.org
Thu Dec 31 20:23:58 PST 2009
#528: Improve Tail Call Elimination
-------------------------------------+--------------------------------------
Reporter: haruki.zaemon@… | Owner: lsansonetti@…
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: MacRuby | Keywords: tail call elimination optimisation tco
-------------------------------------+--------------------------------------
Comment(by haruki.zaemon@…):
Replying to [comment:7 conradwt@…]:
> If you need tail call optimization, then you're definitely concerned
about the wasteful calls because the goal of tail call optimization is to
transform
> recursive alogithm into iterative algorithm.
The aim of TCO is to allow recursive algorithms to perform within a
constrained stack frame. Whether you choose to implement this as re-
writing the algorithm iteratively or instead throwing away the stack frame
is a choice.
> I guess that you're looking for something automatically done with
MacRuby VM.
I don't mind if it's explicit :)
> It's still your requirement to implement the appropriate traversal
algorithm for the data set that you're operating on. In short, one should
use the best algorithm for the job and not rely so heavily on what's
happening within the language's internals.
And I have, twice: once recursively; then again iteratively actually make
it perform. The former being MUCH simpler, the latter being horribly
complex.
I I'm not accusing MacRuby of being flawed, I'm merely suggesting that, as
per the links posted, OO algorithms and data structures can be greatly
improved by languages that support TCO. Yes, it's possible to write
complex algorithms without TCO; it's also much easier to write them with
it.
--
Ticket URL: <http://www.macruby.org/trac/ticket/528#comment:9>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list