@nogc and exceptions

Andrej Mitrovic via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 12 04:38:06 PDT 2014


On 9/12/14, Jakob Ovrum via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> the chaining mechanism will
> construct a self-referencing list that results in an infinite
> loop when the chain is walked

Can we amend the spec to say self-referencing is ok? Then we could
make the default exception handler *stop* if it finds a
self-referencing exception (e.g. for stack traces), and for custom
user code which walks through exceptions it would either have to be
fixed.

We could also provide a helper function for walking through exceptions:

try
{
    ...
} catch (Exception ex)
{
    // some UFCS or object.d built-in method which
    // stops walking when ".next is this"
    foreach (caught; ex.walk)
    {
    }
}

Or does the problem have a bigger scope than just walking?


More information about the Digitalmars-d mailing list