comp.lang.ada
 help / color / mirror / Atom feed
From: Eric Hughes <eric.eh9@gmail.com>
Subject: User-defined type attributes
Date: Wed, 12 Mar 2008 11:58:29 -0700 (PDT)
Date: 2008-03-12T11:58:29-07:00	[thread overview]
Message-ID: <d9065e94-8586-4889-b5c7-a8ca9e8f2248@d21g2000prf.googlegroups.com> (raw)

In light of the recent discussion of formal package parameters, I have
been wondering about user-defined type attributes.  They don't
currently exist in any version of Ada.

First, a historical question: Was there a proposal for user attributes
that was considered for Ada 2005?

My interest in them is akin to my interest in formal package
parameters.  The prefixed views for functions and procedures (dot-
notation) of Ada 2005 are directly analogous to what would be required
for attribute syntax.  This notation hints at the possibility of a
kind of visibility related to formal type parameters, one which would
make ordinary subprograms and attribute functions visible without
making the entire definition package visible.  The idea is that a
formal type parameter create a visibility related only to that type
itself.  In order to make this really useful, attribute functions
would be needed to forestall the use of an entire package, rather than
only a single type.

If this seems abstruse, just consider the character traits that the C+
+ standard library uses.

And a related historical question: Why does the prefixed view of a
subprogram only apply to tagged types?  It seems like a syntax
eminently suited for any subprogram.

An attribute function must evaluate at compile-time, or perhaps more
subtly, prior to elaboration time.  Much of the requisite apparatus is
already present with static expressions and preelaborable packages.
The standard would require an additional definition of the ability to
pre-elaborate a function body.  While such a body might be restricted
to returning a single static expression, that seem a bit restrictive.

My overall motivation (as before) is to enable better, more flexible
library support.  Library support gates usability and enables cost-
justifiable selection of Ada in a greater number of application
domains.  These kinds of features are not so critical for a single
team writing their own software, but rather come into their own when
writing libraries for other people to use in not-yet-anticipated ways.

Eric



             reply	other threads:[~2008-03-12 18:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 18:58 Eric Hughes [this message]
2008-03-12 21:23 ` User-defined type attributes 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
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