From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ee1a8b8db84c88f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ada exception block does NOT work? Date: 20 Aug 2005 19:34:04 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <4301ab29$0$6989$9b4e6d93@newsread2.arcor-online.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1124580921 14716 192.74.137.71 (20 Aug 2005 23:35:21 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 20 Aug 2005 23:35:21 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:4230 Date: 2005-08-20T19:34:04-04:00 List-Id: "Frank J. Lhota" writes: > "Robert A Duff" wrote in message > news:wccslx4gumc.fsf@shell01.TheWorld.com... > > ... > > 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. > > Thats fine, but also understand that to many others, "pointer" does mean "a > single machine address". Agreed. And to some folks, "pointer" implies "you can do arithmetic on it" (i.e. C-style pointers). There's no uniform terminology across programming languages. That's not surprising, given that programming language design is such a new art. >... It certainly does not hurt to introduce a new term > to avoid potential misunderstandings. I think it does hurt to introduce new terms -- we end up with 37 different ways of referring to the same thing (and folks who talk about "methods" have trouble communicating with folks who talk about "procedures" and so on). > > To me, "pointer" and "reference" are synonymous. > > OK, but just be aware that in C++, "pointer" and "reference" are not > synonyms. True. But they're pretty close. The both "point at" or "refer to" things. There are differences in which ones you can copy and whether dereferencing is explicit or implicit and so on. Interesting that we "dereference" pointers. ;-) As opposed to "depointering" them. > > 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. > > So the number 3 can be thought of as a pointer into any array indexed by a > integer. An interesting concept, but this is certainly a non-standard use of > the term "pointer". Really? I sometimes write code something like this: type Stack_Index is range 1..whatever; subtype Stack_Count is Stack_Index'Base range 0..whatever; type Stack(Max: ...) is limited record Top: Stack_Count := 0; -- points to the top element of the stack Elements: Element_Array(1..Max); end record; Do you think "points to" is confusing in the above comment? > > 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. > > For the record, I know of no Pascal compiler that implements a pointer as > anything other than a machine address. That's true. And almost all Ada compilers use single-machine-address to represent almost-all access types. > >> 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. > > Now that is an interesting concept. I am fond of divorcing the language from > platform constrains when practical. There are, however, some practical > concerns about this proposal. An Ada 'bignum' type would undoubtedly be a > controlled type, introducing more overhead than one would expect in a scalar > type. Well, one has to learn what to "expect" in terms of efficiency. In a garbage-collected implementation of Ada, bignum would not need to be a controlled type. If I said "1..2**80", I would "expect" 3 words to be allocated typically on the stack, with no heap usage, and no need for either controlled types or GC. If I said "1..2**1000", I would expect heap usage, and consequent controlled types or GC. If I'm writing a hard real-time embedded system, I probably won't say "1..2**1000". But I'm not even allowedd to say "1..2**80" in any Ada compiler I know of, and I can't even count on "1..2**35" portably. Sigh. - Bob