From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Pass a serial port as user data in a GTK callback handler?
Date: Wed, 19 Feb 2014 17:22:23 -0500
Date: 2014-02-19T17:22:23-05:00 [thread overview]
Message-ID: <wcc8ut64uao.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: le0v9m$bk1$1@loke.gir.dk
"Randy Brukardt" <randy@rrsoftware.com> writes:
> Fascinating. I wouldn't consider that wrong; the problem is the
> inconsistency with anonymous access types (which would be easily solved by
> not introducing them in the first place. ;-). What Ada calls general access
> and pool-specific access types ought to be separated somehow.
I agree that there is some value in distinguishing general from
pool-specific access types. But it comes at a cost in language
complexity -- we commonly see programmers getting confused by it.
So I ended up concluding that the language would be better off
(simpler) if all access types were general, and you can't say
"access all".
I also agree that the inconsistency with anonymous access types
exacerbates the problem. Anonymous access types should be a
simple short-hand for what you get if you declare a named
access type in the usual place. Unfortunately, they have all
sorts of magical properties (coextensions, dynamic accessibility, etc).
The term "pool-specific" is a misnomer, by the way. That's also my
fault -- I was momentarily confused into thinking that a "storage pool"
and a "collection" are the same thing. Perhaps they should be, but
they're not in Ada.
> Requiring the representation of all access types to be the same would force
> pool-specific types to have a worse representation than otherwise
> necessary -- on the U2200, general access types had to include byte-pointers
> (for C compatibility), but pool-specific types could assume word alignment.
> That was a substantial performance difference.
I don't understand that. Access types don't need to be C-compatible
unless you say Convention(C). And anyway, I would expect an int*
on such a machine to be represented by a word-aligned address.
And you can convert from pool-specific to general, so whatever your
representation is, it must allow for that.
> Janus/Ada also uses stronger checking on pool-specific types (for an access
> type using the standard pool, if the value isn't inside the pool, we raise
> an exception rather than trash memory). Can't do that for general access
> types.
At some efficiency cost, you can check for dangling pointers, which
is even better than what you say above. Well, "better" in catching
bugs, but probably a lot worse in terms of efficiency.
> I suppose we could have used an aspect for the difference (if we had had
> aspects in 1993), but having legality depend on aspects is always a bit
> dodgy.
Yes, if the distinction is to be made, I have no problem using the
"access all" syntax for that.
- Bob
next prev parent reply other threads:[~2014-02-19 22:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-15 23:32 Pass a serial port as user data in a GTK callback handler? hreba
2014-02-16 0:35 ` Jeffrey Carter
2014-02-16 16:18 ` hreba
2014-02-16 7:45 ` Niklas Holsti
2014-02-16 16:14 ` hreba
2014-02-16 9:20 ` Dmitry A. Kazakov
2014-02-16 16:57 ` hreba
2014-02-16 18:02 ` Dmitry A. Kazakov
2014-02-17 16:13 ` adambeneschan
2014-02-17 16:20 ` adambeneschan
2014-02-17 21:31 ` Robert A Duff
2014-02-19 0:53 ` Randy Brukardt
2014-02-19 22:22 ` Robert A Duff [this message]
2014-02-20 0:34 ` Randy Brukardt
2014-02-20 11:07 ` Simon Wright
2014-02-20 16:11 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox