Opt-out closures

Sean Eskapp eatingstaples at gmail.com
Sun Jan 23 06:36:27 PST 2011


I get errors when working with nested functions and structs or scoped classes,
because closures can't be used with anything with scoped destruction. This
makes complete sense, but I don't even want the closure functionality of these
nested functions. Personally, I would like to be able to opt-out of the
closure functionality of nested functions: if the enclosing function exits,
and a nested function thereof is called, then a segfault would occur when it
tried to access the stack of its enclosing function; however, access of
scoped-destruction variables from an enclosing-scope function would be fine.

Thoughts? The not-being-able-to-access-scoped-destruction-variables thing is
really getting to me, since one of the main driving features I like about D is
the ability to use anonymous and nested functions.


More information about the Digitalmars-d mailing list