comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: User-defined type attributes
Date: Fri, 14 Mar 2008 10:01:47 +0100
Date: 2008-03-14T10:01:47+01:00	[thread overview]
Message-ID: <1t28s8pm6mnmg.gabilv2a3qm3.dlg@40tude.net> (raw)
In-Reply-To: fa6b81ca-4cbd-4a14-af77-cc1d4c95b204@i29g2000prf.googlegroups.com

On Thu, 13 Mar 2008 20:55:27 -0700 (PDT), Eric Hughes wrote:

> On Mar 13, 1:58 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>> In which sense function is static? If understand what you wrote, it simply
>> means that the name "Callable" is static.
> 
> That's not what I meant.  Here's some sample notation, whose syntax is
> merely illustrative.
> 
>     -- Declaration of an attribute
>     generic
>         task type T ;
>     function T'Callable return boolean ;
> 
>     -- Declaration of a (static) implementation function
>     generic
>         task type T ;
>     function Callable_Impl return access function( X : T ) return
> boolean is static ;

Hmm, what is static here? An instance of the body or the result of
execution of an instance? Let I declare T in a nested block, then
instantiate Callable_Impl there, would it go?

>     -- Binding of an implementation to an attribute
>     generic
>         task type T ;
>         Obj : T ;
>     for Obj'Callable use Callable_Impl.all( X => Obj ) ;
> 
> Regardless of whatever syntax is appropriate, one of the things that
> makes me uncomfortable about attributes is that their definitions
> don't have the same rigor of notation in their definitions as, say,
> the standard libraries do.

Right, because to make it rigorously you have to make "task type" a proper
class. That means, tasks must be tagged, there must be Root_Task type and a
class of. Then you could simply and rigorously write:

   function "'Callable" (T : Root_Task) return Boolean;

> In the spirit of separation compilation,
> I'd like to see attribute definitions in specification packages, even
> if their bodies exist solely within a compiler's implementation.

Sure. Nevertheless this or that way you have to be able to specify that a
body is static (contract on the implementation). That the body is pure (a
permission to derive static result from static arguments). Or do you want
compile-time bodies written in some other (meta) language, like they are in
C and PL/1 preprocessors?

> I wrote:
>> Functions on a type are part of the tradition algebraic
>> specification of a type.  Attributes on a type are part of the
>> language environment inside of which a type specification is
>> expressed.  These are very different.
> 
> "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote:
>> I don't see why this distinction is important.
> 
> I'm afraid I don't know how to argue this point briefly.  It's the
> difference between language (in the proof theory sense) and
> metalanguage.  I guess I've done too much formal logic too see this
> distinction and its import as anything other than obvious.

I see where you are going. It is to consider (some) attributes
automatically instantiated generic functions. Am I right?

That would be indeed a metalanguage. But I am quite uncomfortable with all
three: metalanguage, generics as one, automatic instantiation. As you said,
a metalanguage shall be clearly separated from the object one. This is the
reason why generics are bad, they slip through the barrier and exist at run
time. Similarly attributes inevitably will.

IMO it would much "simpler" (and more useful):

1. to make classes available for all types
2. to introduce pure and static bodies
3. to allow "'X" sugar for user-defined subprograms
4. to specify existing attributes in terms of 1..3.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-03-14  9:01 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  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  1:46       ` Randy Brukardt
2008-03-14  3:55       ` Eric Hughes
2008-03-14  9:01         ` Dmitry A. Kazakov [this message]
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