Re: Ada exception block does NOT work?



"Jeffrey R. Carter" <spam@xxxxxxxx> writes:

> Robert A Duff wrote:
>
> > Ada was certainly not the first language with exceptions.
> > Does anybody know which one was? And were they called "exceptions"
> > and were they "raised" and "handled"?
>
> Perhaps I should have added a smiley in there.

;-)

>... But between Ada and those
> using the C++ notation, Ada was certainly first.

Indeed. I do prefer "raise/handle" to "throw/catch", but maybe because
that's what I'm used to.

There are also exceptions in the hardware world, variously called
"exceptions", "traps", and "synchronous interrupts". I'm talking about
divide-by-zero, overflow, and the like. Surely the software concept
came from that?

> > Besides, there's an element of "pot calling kettle black" here.
> > Ada misuses quite a few terms. For example, pointers should be called
> > "pointers" or "references", not "accesses". And it's an abomination to
> > use the term "integer" for a meager subset of the integers. I believe
> > the term "integer" to refer to the infinite set predates Ada somewhat.
>
> I always thought the whole point of "access" was to not (seem to)
> require them to just be "pointers". Bounds information and the like can
> be part of an access value.

Perhaps also to distinguish them from C-style pointers, which are rather
lower level.

To me, "pointer" does not imply "a single machine address".
To me, "pointer" means something that can point at things,
and that includes fat pointers, pointers containing array
dope, pointers represented as offsets instead of addresses,
double indirections, &c.
To me, "pointer" and "reference" are synonymous.
And "address" or "machine address" can be used for the hardware-level
concept.

An index into an array can be used as a pointer to a particular
array element.

Ada evolved from Pascal, and Pascal called them pointers.
In Pascal, there was no requirement or implication that
they must be a single machine address. There is no need
for array dope in Pascal, but adding array dope doesn't seem
like it requires renaming the whole concept.

> As for Integer, you're quite right, but it's also quite natural to use
> that name (or a shortened form of it) for such a subset. Such a usage is
> quite common in computer languages; see FORTRAN (1955?) for an
> example. What would be a better name for such a type?

I'd use "Integer" for what Lisp calls "bignums" -- integers that can
grow without bound (except of course you can run out of memory,
but that's true of Strings and whatnot, too. I'd call the integer type
that is based on the hardware (e.g. 32-bit integers) "Machine_Integer".
And I wouldn't put it in a package called "Standard" and I wouldn't
make it automatically visible everywhere.

I think one ought to be allowed to say:

type T is range 1..10**100;

Portably.

- Bob
.



Relevant Pages

  • Re: LLVM--Low Level Virtual Machine--and Ada
    ... as it would effectively turn of DEP for LLVM ... Trampolines are not bugs. ... Which includes virtually all Ada programs, ... They wanted to allow pointers to these functions. ...
    (comp.lang.ada)
  • Re: LLVM--Low Level Virtual Machine--and Ada
    ... as it would effectively turn of DEP for LLVM ... Which includes virtually all Ada programs, ... trampolines do not save a clock cycle or two -- they ... They wanted to allow pointers to these functions. ...
    (comp.lang.ada)
  • Re: Custom model in gtkada?
    ... I don't see how Ada could help there. ... but what pointers lack is safety of composition. ... within a primitive subprogram you are safe against re-dispatch. ... Another orthogonal problem is safe composition: widgets as containers, ...
    (comp.lang.ada)
  • Re: pointer questions
    ... I use pointers all the time. ... anonymous access types -- there are probably hundreds of those ... You need pointers in Ada whenever you have complex data ... If I designed a language, I would go even further in that direction. ...
    (comp.lang.ada)
  • Re: best approach to develop running software
    ... it depends on programming style rather than on the language ... > One parameter is a pointer into an array of int. ... > In my function I use pointers for two different abstractions. ... > The Ada example will always work correctly. ...
    (comp.programming)