comp.lang.ada
 help / color / mirror / Atom feed
* Questions on implementations and specs
@ 2001-10-11 17:03 chris.danx
  2001-10-11 18:31 ` chris.danx
  2001-10-12 10:31 ` Aidan Skinner
  0 siblings, 2 replies; 7+ messages in thread
From: chris.danx @ 2001-10-11 17:03 UTC (permalink / raw)


Hi,

I'm working with XMLAda and would like to be able to detect if a file could
not opened, but I see XMLAda provides no such exception or routine.  XMLAda
uses the package direct io (in input_sources.file), which means that a
name_error will be raised should opening the file not be possible.  Should I
rely on the fact that it is based on direct io and therefore will raise the
name_error exception or should I do something else?

I'm not knocking XMLAda for not providing an exception in it's spec for this
condition, it's just I've seen that sometimes an assumption is made that
standard exception will be propagated from standard routines and expect the
user to know this or look at the implementation (i.e. the exception is not
documented).  I was under the impression that the programmer should not need
to look at the implementation *in most cases* (of course there are cases
when we do need to look at the implementation).

Is it common to assume this implicitly?  I recognise that the designer(s) of
XMLAda may have chosen this deliberately or haven't got to this yet (since
it's a beta), I'm curious about this in general.



Chris Campbell

p.s.  In the case of XMLAda, I've just noted that it does propagate this
exception by putting it as a renaming in the file (adding Name_Error :
exception renames Ada.IO_Exceptions.Name_Error at the top of
input_sources.file (spec)).  This isn't a big deal, and I don't want it to
turn into one.







^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Questions on implementations and specs
  2001-10-11 17:03 Questions on implementations and specs chris.danx
@ 2001-10-11 18:31 ` chris.danx
  2001-10-11 22:39   ` chris.danx
  2001-10-12 10:31 ` Aidan Skinner
  1 sibling, 1 reply; 7+ messages in thread
From: chris.danx @ 2001-10-11 18:31 UTC (permalink / raw)



"chris.danx" <chris.danx@ntlworld.com> wrote in message
news:Ahkx7.4857$i14.643289@news2-win.server.ntlworld.com...
> Hi,

> p.s.  In the case of XMLAda, I've just noted that it does propagate this
> exception by putting it as a renaming in the file (adding Name_Error :
> exception renames Ada.IO_Exceptions.Name_Error at the top of
> input_sources.file (spec)).  This isn't a big deal, and I don't want it to
> turn into one.

Further investigation of the XMLAda packages reveals that this isn't
correct.  Name_Error doesn't appear propagated at all, my appologies to the
XMLAda folks!

I'm still interested to know what the advice on the issue of documenting
propagation of exceptions is.


Chris




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Questions on implementations and specs
  2001-10-11 18:31 ` chris.danx
@ 2001-10-11 22:39   ` chris.danx
  0 siblings, 0 replies; 7+ messages in thread
From: chris.danx @ 2001-10-11 22:39 UTC (permalink / raw)



"chris.danx" <chris.danx@ntlworld.com> wrote in message
news:vzlx7.5831$i14.735621@news2-win.server.ntlworld.com...
>
> "chris.danx" <chris.danx@ntlworld.com> wrote in message
> news:Ahkx7.4857$i14.643289@news2-win.server.ntlworld.com...
> > Hi,
>
> > p.s.  In the case of XMLAda, I've just noted that it does propagate this
> > exception by putting it as a renaming in the file (adding Name_Error :
> > exception renames Ada.IO_Exceptions.Name_Error at the top of
> > input_sources.file (spec)).  This isn't a big deal, and I don't want it
to
> > turn into one.
>
> Further investigation of the XMLAda packages reveals that this isn't
> correct.  Name_Error doesn't appear propagated at all,

It's not a good day, and I feel really stupid for making this mistake but
the exception is propagated (found out when attempted to open a file that
was mispelled).  My mistake doubled.  I appologise for any confusion and
will try to not get confused and distracted and then write wrong information
on public newsgroups in future.


My appologies,
Chris





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Questions on implementations and specs
  2001-10-11 17:03 Questions on implementations and specs chris.danx
  2001-10-11 18:31 ` chris.danx
@ 2001-10-12 10:31 ` Aidan Skinner
  2001-10-12 12:39   ` chris.danx
  1 sibling, 1 reply; 7+ messages in thread
From: Aidan Skinner @ 2001-10-12 10:31 UTC (permalink / raw)


On Thu, 11 Oct 2001 18:03:41 +0100, chris.danx <chris.danx@ntlworld.com>
wrote in <Ahkx7.4857$i14.643289@news2-win.server.ntlworld.com>:

>  documented).  I was under the impression that the programmer should not need
>  to look at the implementation *in most cases* (of course there are cases
>  when we do need to look at the implementation).

This is one of the areas where I like Java over Ada. The raises statement
and it's enforcement by the compiler are, IMO, very very useful.

Being able to see clearly what each method/function/procedure can generate
is a great help, although they should be documented by the package spec,
it's not always...

I also like the try/catch statements, but I'm happy to live without those...

- Aidan
-- 
http://www.velvet.net/~aidan/           aidan@velvet.net
No Fear




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Questions on implementations and specs
  2001-10-12 10:31 ` Aidan Skinner
@ 2001-10-12 12:39   ` chris.danx
  2001-10-12 16:43     ` Darren New
  0 siblings, 1 reply; 7+ messages in thread
From: chris.danx @ 2001-10-12 12:39 UTC (permalink / raw)



"Aidan Skinner" <aidan@velvet.net> wrote in message
news:slrn9sdhka.hnq.aidan@crushed.velvet.net...
> On Thu, 11 Oct 2001 18:03:41 +0100, chris.danx <chris.danx@ntlworld.com>
> wrote in <Ahkx7.4857$i14.643289@news2-win.server.ntlworld.com>:
>
> >  documented).  I was under the impression that the programmer should not
need
> >  to look at the implementation *in most cases* (of course there are
cases
> >  when we do need to look at the implementation).
>
> This is one of the areas where I like Java over Ada. The raises statement
> and it's enforcement by the compiler are, IMO, very very useful.

It might be nice to see some optional method of specifying exceptions that a
routine may generate (need not specify them all), like

name_error : exception;

procedure open (file : file_type)
   with exception (name_error, blah_blah);

but I think the Java 'must specify exceptions' is a pain mostly (even though
it helps with documenting exceptions).

> Being able to see clearly what each method/function/procedure can generate
> is a great help, although they should be documented by the package spec,
> it's not always...

There are a lot of implied exceptions (like constraint_error) which don't
need documentation but in some cases where a condition could arise that is
important and there is no alternative method to detect the condition, the
exception signalling the condition should be documented, IMO.



Chris




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Questions on implementations and specs
  2001-10-12 12:39   ` chris.danx
@ 2001-10-12 16:43     ` Darren New
  2001-10-14 13:41       ` Marc A. Criley
  0 siblings, 1 reply; 7+ messages in thread
From: Darren New @ 2001-10-12 16:43 UTC (permalink / raw)


> but I think the Java 'must specify exceptions' is a pain mostly (even though
> it helps with documenting exceptions).

It's mostly a pain when you're dealing with callbacks, tho. If your
comparison routine might throw an error, and your sort routine doesn't
declare the comparison routine as capable of throwing an error, you're
pretty screwed.

Of course, you can throw a run-time exception, but that kind of defeats
the purpose of declaring such things.

-- 
Darren New 
San Diego, CA, USA (PST). Cryptokeys on demand.
                   Who is this Dr. Ibid anyway, 
                  and how does he know so much?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Questions on implementations and specs
  2001-10-12 16:43     ` Darren New
@ 2001-10-14 13:41       ` Marc A. Criley
  0 siblings, 0 replies; 7+ messages in thread
From: Marc A. Criley @ 2001-10-14 13:41 UTC (permalink / raw)


Darren New wrote:
> 
> > but I think the Java 'must specify exceptions' is a pain mostly (even though
> > it helps with documenting exceptions).
> 
> It's mostly a pain when you're dealing with callbacks, tho. If your
> comparison routine might throw an error, and your sort routine doesn't
> declare the comparison routine as capable of throwing an error, you're
> pretty screwed.
> 
> Of course, you can throw a run-time exception, but that kind of defeats
> the purpose of declaring such things.

Just as a point of information:

The theme of the 9/01 issue of SIGAda's Ada Letter's publication is what
to do about Ada's exceptions.  There's pretty universal agreement that
Ada's exception model is not well integrated with the rest of the
language (which is oriented around a comprehensive typing model), and
that the exception capabilities provided by C++ and Java are superior in
most aspects.

It appears likely that people want some kind of significant improvement
of the exception model for Ada 0Y, it's just not clear yet what the form
of that improvement will be.

Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-10-14 13:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-11 17:03 Questions on implementations and specs chris.danx
2001-10-11 18:31 ` chris.danx
2001-10-11 22:39   ` chris.danx
2001-10-12 10:31 ` Aidan Skinner
2001-10-12 12:39   ` chris.danx
2001-10-12 16:43     ` Darren New
2001-10-14 13:41       ` Marc A. Criley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox