The Artima Developer Community
Sponsored Link

Weblogs Forum
Musing about Closures

30 replies on 3 pages. Most recent reply: Oct 24, 2005 6:54 PM by Howard Lovatt

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 30 replies on 3 pages [ « | 1 2 3 ]
Howard Lovatt

Posts: 321
Nickname: hlovatt
Registered: Mar, 2003

Re: Musing about Closures Posted: Oct 24, 2005 6:54 PM
Reply to this message Reply
Advertisement
@Patrick O'Grady

For a language that is optimised at compile time your suggestion is a very good one, since it allows a useful optimisation.

For a language that is optimised at runtime, like Java, they can recognise the local function and do the optimisation anyway. If you see the benchmark I wrote above the current release of Java is almost as fast with heap allocation as stack allocation and in the next version they are adding escape analysis. Escape analysis looks for pointers that escape the local context, e.g. your onEvent example, and these it leaves alone. But the pointers that don't excape it allocates on the stack, therefore they can do the optimisation in J6 automatically without requiring the extra keyword.

Flat View: This topic has 30 replies on 3 pages [ « | 1  2  3 ]
Topic: Lua and HeronScript Previous Topic   Next Topic Topic: Back to Generics: Contravariance and Erasure

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use