Re: Structured exception information
- From: Stephen Leake <stephen_leake@xxxxxxxxxxxxxxxx>
- Date: Fri, 19 Jan 2007 04:47:28 -0500
Maciej Sobczak <no.spam@xxxxxxxxxxx> writes:
Then what's wrong with a string?Generally, all you can do is report the error toThat's what I want to do.
the user.
Doesn't feel as type-safe as advertised.
But you have not given an actual example where a string is not
a type-safe solution to the actual problem at hand.
The only example you have given is "present the error to the user". In
that case, a string is precisely the correct type.
[...]- error codeAll of this can be put into the string by the routine raising the
- error message
- line number
- character position
- hint from the engine
- timestamp from within the engine
- ...
exception:
Sure. That's why there are more JavaScript programmers than Ada programmers.
I don't follow. Strings are perfectly valid Ada constructs. Why does
the code to build the string not feel like Ada to you?
raise Database_Error with "Error " & Error_Code_Type'image
(Error_Code) & ": " & Time_Type'image (Timestamp) & ": " &
file_name & ":" & Integer'image (Line_Number) &
":" & Integer'image (Character_Position) & ": " & Message &
": " & Hint;
Of course, with similar routine for dismantling all this in the
handler.
You have not said _why_ you need to dismantle this information in the
handler. What, _exactly_, will the handler do with the separate bits?
Still, that's not what I expect from Ada.
Lots of people expect lots of things. Sometimes, those expectations
are unreasonable, and should be changed. That's what I'm trying to
explore here; I think expecting anything other than a string for
exception data is unreasonable.
So far, you have presented no case to show I am wrong.
As a general matter of user-interface design, I would find that
annoying. As a user of a system, the only thing I want from an error
message is either "how do I fix this myself" or "how do I report this
to the maintenance team".
That is a reasonable approach and will work fine most of the time,
When will it not work? I have never encountered such a case.
but it does not explain the lack of a language feature that is taken
for granted in other languages - and coming from another language, I
find the lack of structured exception information as a defect, even
though I realize that I can easily work around it. The point is that
I should not be forced to work around anything.
If you look into the details of "structured exception handling" in
other languages and implementations, they have bugs, and fundamental
flaws in design. That is why Ada did not go that way. Ada is _much_
more careful about getting the core design right, allowing fully
robust and safe implementations of _all_ features, especially in
multi-tasking and multi-processing environments.
So if you find yourself fighting Ada to do something, you need to step
back and think more carefully about _why_ you are doing it that way.
Ada is telling you it is inherently unsafe.
--
-- Stephe
.
- Follow-Ups:
- Re: Structured exception information
- From: Robert A Duff
- Re: Structured exception information
- From: Ray Blaak
- Re: Structured exception information
- From: Robert A Duff
- Re: Structured exception information
- From: Maciej Sobczak
- Re: Structured exception information
- From: Dmitry A. Kazakov
- Re: Structured exception information
- References:
- Structured exception information
- From: Maciej Sobczak
- Re: Structured exception information
- From: Stephen Leake
- Re: Structured exception information
- From: Maciej Sobczak
- Re: Structured exception information
- From: Stephen Leake
- Re: Structured exception information
- From: Maciej Sobczak
- Structured exception information
- Prev by Date: Re: Limited_Controlled and constructor functions
- Next by Date: Re: Limited_Controlled, orthogonality and related issues
- Previous by thread: Re: Structured exception information
- Next by thread: Re: Structured exception information
- Index(es):
Relevant Pages
|