[nem-en] Exception matching

Vladimir Reshetnikov v.reshetnikov at gmail.com
Sun Jan 28 19:30:45 CET 2007


Can I do something like this?

using System;
using System.Console;

variant ProgramException : Exception {
    | Failure
    | Warning {
        severity : int
    }
}

try {
    throw ProgramException.Failure();
}
catch {
    | ProgramException.Failure /* error : exception catch pattern must be in
form of `| e is ExceptionType => handler' or`| e => handler' for
System.Exception */
    | ProgramException.Warning(severity) when severity > 10
        => WriteLine("Oops");
}

Why currently ncc does not allow such patterns in catch block?




More information about the devel-en mailing list