Are exceptions a good model for systems programming ? - legacy C programs cant call you without a wrapper which translates all possible exceptions - unwinding a stack is probably not a good idea in a kernel or when you transition into protected/user mode.( I know of very few kernels that use exceptions ). - Its not just legacy , Winrt uses C++ classes but returns error codes tor low level APIs.
However its very nice for user programs . These days these different worlds works quite well , c libs which Is mainly used for system programming don't use them and C++ apps are more user programs and they do , C++ calls C , C rarely calls C++. Obviously if you write a kernel or shared library you cannot use exceptions if c programs call your code and there is a lot of c out there.... While not really an issue for the language ( just dont use exceptions) it means a standard lib that throws an exception would be a pain for such work and you would need a different standard lib , which is an issue . BTW could Rust use tasks as a substitute for exception scopes ? Tasks have error bubbling , hiding , "stack unwinding" , throw ( fail) and should have integrated logging . You could put a sugar syntax around it but it would still work when being called by c. Also with tasks you can cancel or do timeouts giving asynronous exceptions which are really needed ( eg in most systems cancel a long running task is very anoying very long pause). and which most trivial exception implementations don't do ..Not sure if this is the right way but there seems a lot of overlap and it would work with C and systems programming,. Ben _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev