[nem-en] Re: The ReportFatal problem

Kamil Skalski kamil.skalski at gmail.com
Tue Feb 13 20:57:02 CET 2007


There is no point in blinded-mind slogans. If some design is
convenient, it is good, unless it causes problems when new features
are added (which is maybe the case now).
Exceptions should be used for:
- exceptional situations, which does not occur in expected (or maybe
most common) workflow
- cases when error cannot be handled properly (and completely) at
given point - we just pass the desicion to the chief (the higher
abstraction layer of app)
- handling the uncommon situations by means of returning success
codes, etc. would require doubling (or worse) the application logic

Handling errors in compiled code more or less fit into those points.
Using Exceptions for control flow is a bad design in most cases, but I
see it completely valid if you have a few tousand lines of complex
logic and few places which should break the current processing up to
some point independently.

The usage of

def (value, code) = foo ();
if (code == SUCCESS)
   ...
else
  ...

vs

try {
  def value = foo ();
  ...
} catch {
  | e is MyException => ...
}

is almost the same, but with first case you need to add handling of
"code" at every f... level of call graph.



2007/2/13, vc <vc at rsdn.ru>:
>
> > Exectly. And performance is not a problem here, since we're not going
> > to signal thousands of errors during a single compilation... well...
> > at least we weren't, but now with intelli sense I'm not so sure.
>
> Performance not a problem, but workflow on exception is real problem. Such a
> solution was very (extremely) uncongenially.
>
> Exception is goto in OO world.
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>


-- 
Kamil Skalski
http://nazgul.omega.pl



More information about the devel-en mailing list