Blocks in g++ ?
Thomas Steffen
for_replies_only@iname.com
Thu Jun 10 23:40:00 GMT 1999
Per Bothner <bothner@pacbell.net> wrote:
Per> It is worth pointing out that blocks, if implemented as
Per> lexical closures as is the de facto Smalltalk standard, are
Per> much more powerful than Gcc's nested functions, since the
Per> latter do *not* create proper closures.
yes, that's what i thought. afaik you can't pass nested functions as
parameters to unrelated calls (in a foreign context), where you can
pass closures.
the other difference is syntax, two closures (even with parameters) in
one line is possible and might even make sense. but you don't wont to
declare two functions (or even classes) within one line...
Per> (Creating closures is probably not practical unless you have
Per> garbage collection.)
that would explain why i have found only one case of closures in a
compiler (one of the objective-C compilers, not gcc). could you
explain why?
i know that closures are probably difficult to support. but i could
imagine that you can pass the definition context (stack frame) just
like you pass 'this' to every method. so you could access the two
different contexts. and the problem of nested closures could be solved
much the same way as for nested functions or nested classes. what am i
missing?
"Thomas Steffen" <for_replies_only@iname.com>
--
We regret to announce that Windows 2000 wont be ready before 1901.
More information about the Gcc
mailing list