comp.lang.ada
 help / color / mirror / Atom feed
From: Eric Hughes <eric.eh9@gmail.com>
Subject: Re: User-defined type attributes
Date: Sun, 16 Mar 2008 21:38:37 -0700 (PDT)
Date: 2008-03-16T21:38:37-07:00	[thread overview]
Message-ID: <c6b7e0b5-6b81-486a-8054-becd0df9842b@h11g2000prf.googlegroups.com> (raw)
In-Reply-To: frffkg$2n5$1@jacob-sparre.dk

On Mar 14, 9:20 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> Indeed, that is a frequent gripe that we (the ARG) have, and
> something we try to avoid introducing more of. But I doubt that it can
> really be fixed, simply because of compatibility. We can't change the
> semantics of existing programs in ways that would break much of the existing
> Ada code.

Well, I don't think any of the ideas I've had recently about dot-
notation are in the realm of changing pre-existing semantics.
Instead, I'm concerned with keeping existing syntax patterns,
enlarging the domain of applicability of that syntax, and creating new
semantics that match existing practice.  While that becomes more
difficult as time goes forward, I think Ada's been pretty good about
making conservative choices that attenuate the consequences of
otherwise-rash decisions.

> Thus you get things like tagged types which simply work better than other
> kinds of types. That was introduced in Ada 95, and we have been happy to
> continue it going forward.

Tagged types do work better, sure.  But they're not a panacea,
either.  It would a mistake to address other difficulties with types
by shoehorning "solutions" to them into tags.  And in the last couple
of days I've realized the problems with untagged types as formal
parameters is much greater than the absence of dot-notation.

So here's a brief example.  I'm writing a smart accessor package set
right now.  As something of an exercise, I'm doing this as generically
as possible.  So I'm looking to write code that can use both intrusive
(part of the managed object) and accretive (separate from the managed
object) allocation strategies for reference counts.  And I want to do
it without making the accessor types tagged.  Since an intrusive
accessor is simple a wrapped-up access object, adding a tag would
double the machine size of an object.  I consider this a poor result
for a system-level library.

My first foray at solving this was to use a formal type parameter for
the implementation of the accessor.  The intrusive implementation
would contain just an access object; the accretive one would have that
plus an access to a reference count.  Pretty simple, so I thought.
But without using a tagged type in the formal parameter definition,
there's no visibility either for record components or for implicit
visibility of operators on that type.  Thus I couldn't get at
components either directly or indirectly.  I discarded that approach.

It's a shame really, because it would otherwise be a natural
representation of variety of in possible implementations.  I'm still
looking at other ways of approaching the problem.  I'm beginning to
suspect that doing this may be impossible, but I don't have an
argument yet.

Eric



  reply	other threads:[~2008-03-17  4:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 18:58 User-defined type attributes Eric Hughes
2008-03-12 21:23 ` Dmitry A. Kazakov
2008-03-13 18:32   ` Eric Hughes
2008-03-13 19:58     ` Dmitry A. Kazakov
2008-03-14  1:46       ` Randy Brukardt
2008-03-14  1:46       ` Randy Brukardt
2008-03-14  9:00         ` Dmitry A. Kazakov
2008-03-14 14:36           ` User-defined type attributes (replacing genericity) Georg Bauhaus
2008-03-15  3:04           ` User-defined type attributes Randy Brukardt
2008-03-15  9:33             ` Dmitry A. Kazakov
2008-03-14 14:31         ` User-defined type attributes (replacing genericity) Georg Bauhaus
2008-03-14 14:48           ` Dmitry A. Kazakov
2008-03-14 17:51             ` Eric Hughes
2008-03-14 18:58               ` Dmitry A. Kazakov
2008-03-14 20:19                 ` Eric Hughes
2008-03-15  4:01               ` Randy Brukardt
2008-03-14 16:58           ` Georg Bauhaus
2008-03-14 18:39             ` Dmitry A. Kazakov
2008-03-15  9:39               ` Dmitry A. Kazakov
2008-03-14  1:46       ` User-defined type attributes Randy Brukardt
2008-03-14  3:55       ` Eric Hughes
2008-03-14  9:01         ` Dmitry A. Kazakov
2008-03-14 18:04           ` Eric Hughes
2008-03-14  1:46 ` Randy Brukardt
2008-03-14  4:41   ` Eric Hughes
2008-03-15  3:20     ` Randy Brukardt
2008-03-17  4:38       ` Eric Hughes [this message]
2008-03-17 21:03         ` Randy Brukardt
2008-03-17 21:58           ` Eric Hughes
replies disabled

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