On 12/07/2013, at 8:07 AM, Chris Velevitch <[email protected]> wrote:

> On Thu, Jul 11, 2013 at 3:15 PM, Robin Hilliard <[email protected]> 
> wrote:
>  
> I should point out that because the recursion is on the last line of the 
> function this is "tail recursive" - the compiler will notice this and 
> optimise the code by throwing away the current stack frame (which would have 
> been used by later statements in the function had they existed) each time the 
> recursive call is made, so you don't need to worry about a stack overflow - 
> this is how functional languages iterate efficiently.
> 
> 
> Are you saying that Railo does tail recursion optimisation?  Do you know if 
> ACF does tail recursion optimisation?

Actually I'd like to make a (very surprising to me) correction - unlike many 
VMs and interpreters for other languages the Sun JVM does not support "hard" 
(in VM) tail call optimisation, whereas the IBM JVM does support it where 
possible. There is ongoing discussion as to whether or not Java 8 will support 
it. I assumed tail call optimisation was universal - it's not hard to 
implement, for example little virtual machine I wrote for my Greener Threads 
talk at CFOANZ included tail call optimisation for a simple subset of cfscript. 
Apparently the java permission mechanism and the need to include a stack trace 
in exceptions have prevented it to date.

I do not know off hand if ColdFusion or Railo support any soft tail call 
optimisation when compiling CFML to byte code. 

Thanks,
Robin

 



Robin Hilliard
Chief Technology Officer


RocketBoots Pty Ltd
Level 11
189 Kent Street
Sydney NSW 2001
Australia       map
Phone   +61 2 9323 2507
Facsimile       +61 2 9323 2501
Mobile  +61 418 414 341
email           [email protected]
web             www.rocketboots.com.au




-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/groups/opt_out.


<<inline: rb_logo.png>>

Reply via email to