I've just been through the exercise of looking in detail at what adding this feature would require. It turns out that the changes are a lot more intrusive than first meets the eye. The changes go through all levels of Ice, from the parser and code generator right down to the protocol. My estimate is that it will take a minimum of two weeks solid work to implement this.
You are right in that C++ and Java permit me to use arbitrary types (in Java, almost arbitary types) as exceptions. But then again, how often does an exception actually get passed as data or stored in a struct? Not very often, I think.
So, for the time being, we've decided to put this feature on ice (pun intended). If you want to pass exception info, or make causality chains of exceptions, you can do so using the following:
Code:
class ExceptionBase {
ExceptionBase previous; // Link to lower-level exception
};
class ErrorCondition1 extends ExceptionBase {
// Data members here...
};
class ErrorCondition2 extends ExceptionBase {
// Data members here...
};
// etc...
exception Error1 {
ErrorCondition1 details;
};
exception Error2 {
ErrorCondition2 details;
};
// etc...
With that, you can pass exception data as a parameter, store exceptions in structure members or similar, and you can chain exceptions together to create a causality chain as a low-level exception is thrown and handled at various levels of the exception handling hierarchy.
That provides pretty much the same functionality as making exceptions first-class data types and should be sufficient for the few applications that need it, I would hope.
Cheers,
Michi.