Path: utzoo!attcan!uunet!snorkelwacker!mit-eddie!uw-beaver!uw-june!jmaloney From: jmaloney@cs.washington.edu (John Maloney) Newsgroups: comp.object Subject: Re: code blocks (aka closures) Message-ID: <12448@june.cs.washington.edu> Date: 2 Jul 90 23:25:29 GMT Organization: U of Washington, Computer Science, Seattle Lines: 22 Brad Cox and Andrew Koenig's messages nicely summarize both the motivation for and the implementation problems with adding closures ("blocks") to a language like C++ or Objective-C. He points out that the implementation problems are deep because: full closures require dynamically allocated variable contexts, a garbage collector is required to get rid of these contexts when they are no longer referenced, and adding garbage collection to C is hard because it is difficult for the runtime system to know for certain which variables contain pointers and which contain integers. Syntax and parsing issues are relatively unimportant compared to these implementation problems. I still maintain that closures are a powerful and useful language feature and think they should stay on the "wish list". Of course, I also believe that garbage collection is well-worth the 10% overhead that a good incremental garbage collector consumes. Programmers' time and program correctness are far more important than a program than runs a mere 10% faster. -- John