comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: put of access type
Date: Thu, 20 Aug 2009 08:42:46 -0700 (PDT)
Date: 2009-08-20T08:42:46-07:00	[thread overview]
Message-ID: <fc232bcc-652e-494a-93e0-0d2260454689@j9g2000prh.googlegroups.com> (raw)
In-Reply-To: ur5v6x63k.fsf@stephe-leake.org

On Aug 20, 1:05 am, Stephen Leake <stephen_le...@stephe-leake.org>
wrote:
> Dennis Lee Bieber <wlfr...@ix.netcom.com> writes:
>
> > On Tue, 18 Aug 2009 23:36:15 -0400, Rob Solomon
> > <use...@drrob1-noreply.com> declaimed the following in comp.lang.ada:
>
> >> The only way I know to see the results of my playing is to output
> >> them.
>
> >    And what meaning would some address from either the stack or a heap
> > have? You can't modify them -- Ada's access types are so heavily
> > controlled they are basically black boxes with no inherent meaning.
>
> Yes, but seeing the actual values helps the learning process.

I don't see how.  If the goal is to learn to use Ada to write more-or-
less "normal" programs, then there's no particular value in seeing the
actual "value" of an access object, as opposing to simply "knowing"
that a non-null access object designates some other object.  In fact,
I'd argue the opposite: It helps the learning process to force oneself
to think of access values as "black boxes" that designate some other
object, because it helps one get in the mind-set of thinking in terms
of abstractions that you can use without knowing how they're
implemented.  And Ada is definitely a language that allows and
encourages a programmer to think that way---it's not perfect, but it's
pretty good.  I think that C programmers in particular who are trying
to learn Ada probably need this sort of mental discipline to change
the way they think about programming.  I've seen too much Ada code
written by C programmers who didn't make this change.  The code is
terrible---very difficult to read and maintain.  I don't know Modula-2
at all, and I thought it was better than C at allowing an
"abstraction" approach to programming; but from Rob's comment that a
pointer is assignment-compatible with System.Address, apparently it
isn't better, at least in that one aspect.

However, if the goal is to learn Ada to do systems programming, or
write other programs where it's *necessary* to do low-level meddling
like Unchecked_Conversion and that sort of thing, then I'd say you're
right.


> A : aliased Interfaces.Unsigned_32;
> B : aliased Interfaces.Unsigned_32;
>
> begin
>     Put (To_Integer (A'access));
>     Put (To_Integer (B'access));
>
> The results should be 4 bytes apart.

Ummm... why?  What rule in Ada says that the compiler has to put A and
B next to each other?

                                      -- Adam




  reply	other threads:[~2009-08-20 15:42 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18 22:26 put of access type Rob Solomon
2009-08-18 23:17 ` Jeffrey R. Carter
2009-08-19  3:36   ` Rob Solomon
2009-08-19  7:44     ` Jean-Pierre Rosen
2009-08-20  8:06       ` Stephen Leake
2009-08-19 11:16     ` Robert A Duff
     [not found]     ` <k_2dncb9WoxvFRbXnZ2dnUVZ_jmdnZ2d@earthlink.com>
2009-08-20  8:05       ` Stephen Leake
2009-08-20 15:42         ` Adam Beneschan [this message]
2009-08-21  8:24           ` Stephen Leake
2009-08-19  6:25 ` Martin Krischik
2009-08-19  7:21 ` Dmitry A. Kazakov
2009-08-19 19:00   ` Rob Solomon
2009-08-19 19:44     ` sjw
2009-08-20  1:54       ` Rob Solomon
2009-08-20  2:06         ` Rob Solomon
2009-08-20 15:18         ` (see below)
2009-08-19 21:01     ` Adam Beneschan
2009-08-19 22:45       ` Randy Brukardt
2009-08-20  6:18         ` Martin Krischik
2009-08-21  0:18           ` Randy Brukardt
2009-08-21  1:20             ` Adam Beneschan
2009-08-21 14:47             ` Robert A Duff
2009-08-21 21:43               ` Randy Brukardt
2009-08-22  0:07                 ` Robert A Duff
2009-09-01  1:57                   ` Randy Brukardt
2009-08-20  6:08     ` Martin Krischik
2009-08-20 20:57     ` Robert A Duff
2009-08-20  6:01   ` Martin Krischik
2009-08-20 17:54     ` tmoran
2009-08-31  7:08       ` Martin Krischik
2009-08-20 18:58     ` Dmitry A. Kazakov
2009-08-20 22:27       ` sjw
2009-08-21  7:29         ` Dmitry A. Kazakov
2009-08-21 21:09           ` sjw
2009-08-31  7:12             ` Martin Krischik
2009-08-20 20:29     ` Robert A Duff
2009-08-21  8:18       ` Stephen Leake
2009-08-21 14:31         ` Robert A Duff
2009-08-21 14:41         ` Robert A Duff
2009-08-22 12:02           ` Stephen Leake
2009-08-20  8:09   ` Stephen Leake
     [not found]     ` <GoydnWoDmpUW4BDXnZ2dnUVZ_rKdnZ2d@earthlink.com>
2009-08-21  8:31       ` Stephen Leake
2009-08-21  8:42         ` Dmitry A. Kazakov
replies disabled

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