comp.lang.ada
 help / color / mirror / Atom feed
From: Serge Robyns <serge.robyns@gmail.com>
Subject: Re: accessibility check failed
Date: Sun, 29 Nov 2015 14:53:01 -0800 (PST)
Date: 2015-11-29T14:53:01-08:00	[thread overview]
Message-ID: <29d3244c-1769-4cb7-8af3-e1b20eb2e1e2@googlegroups.com> (raw)
In-Reply-To: <n3fu9a$h2j$1@dont-email.me>

On Sunday, 29 November 2015 23:32:30 UTC+1, Jeffrey R. Carter  wrote:
> On 11/29/2015 12:00 PM, Serge Robyns wrote:
> > On Sunday, 29 November 2015 19:37:07 UTC+1, Jeffrey R. Carter  wrote:
> It's quite genuine. The most common problems posted on here of the "Why am I
> getting this msg?" or "Why doesn't this do what it should?" sort relate to
> anonymous access types and programming by extension. I conclude that they were
> mistakes and should not have been added to the language. My aversion to
> programming by extension goes back to the early 1990s when it was proposed for
> Ada 9X. I experimented with the proposals and found that it makes code harder to
> read than equivalent code without it.
> 
> Access types are notoriously error-prone, so any necessary use of them should be
> hidden as deeply as possible (and given the unbounded containers, there are very
> few necessary uses). Using public access types and foisting what should be
> hidden onto the clients of the pkgs in which they appear may make them easier to
> write, but harder to use, and increases errors in the overall program. Avoiding
> public access types is a design rule I follow scrupulously.
> 
> -- 

In my case I'm trying to build an interface to hide implementation details.  The code provided is using containers as a store but should also be able to use any kind of (R)DBMS for all or part of the data.  And hence this is where the beauty of OO comes but does indeed require to use access type to "keep" track of things.

I admit I'm trying to implement some patterns that typically relies on "references".  What would be the alternative to a Bridge pattern.

Ada brings a lot of value with tagged types which other OO languages to fail to have, at least AFAIK.  For example, Ada will check the tag type when allocating/converting from 'Class return to whatever.  In my case X := T_ABC_DAO (func (xyz)); it will check that func(p) return T_ABC'Class has indeed returned something that is a T_ABC_DOA.

I do admit that OO brings more "indirection" than strait code but then often people implement something similar by building their own dispatches or alike.

Serge

  reply	other threads:[~2015-11-29 22:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-29 18:03 accessibility check failed Serge Robyns
2015-11-29 18:37 ` Jeffrey R. Carter
2015-11-29 19:00   ` Serge Robyns
2015-11-29 22:32     ` Jeffrey R. Carter
2015-11-29 22:53       ` Serge Robyns [this message]
2015-11-30  2:04         ` Jeffrey R. Carter
2015-11-30 23:22         ` Randy Brukardt
2015-12-01  9:38           ` Serge Robyns
2015-11-29 19:15 ` Dmitry A. Kazakov
2015-11-29 22:40 ` Serge Robyns
2015-12-01 20:17 ` sbelmont700
  -- strict thread matches above, loose matches on Subject: below --
2014-08-11  2:12 Accessibility " hreba
2014-08-11  5:32 ` Jeffrey Carter
2014-08-11 16:45   ` hreba
2014-08-11 16:55     ` Jeffrey Carter
2014-08-12 11:57       ` hreba
2014-08-11 19:56 ` sbelmont700
2014-08-11 20:17   ` Jeffrey Carter
2014-08-11 20:28     ` sbelmont700
2014-08-11 21:14       ` Jeffrey Carter
replies disabled

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