Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: User-define...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 23 Topic 5595 of 5874
Post > Topic >>

Re: User-defined type attributes

by "Dmitry A. Kazakov" <mailbox@[EMAIL PROTECTED] > Mar 14, 2008 at 10:01 AM

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

> On Mar 13, 1:58 pm, "Dmitry A. Kazakov" <mail...@[EMAIL PROTECTED]
>
> 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...@[EMAIL PROTECTED]
> wrote:
>> I don't see why this distinction is im****tant.
> 
> 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 im****t 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 cl***** 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
 




 23 Posts in Topic:
User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-12 11:58:29 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-12 22:23:43 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-13 11:32:23 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-13 20:58:15 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-13 20:46:41 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-13 20:46:41 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-13 20:46:41 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-14 10:00:46 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-14 22:04:53 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-15 10:33:38 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-13 20:46:37 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-13 20:55:27 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-14 10:01:47 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-13 21:41:21 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-14 22:20:19 
Re: User-defined type attributes (replacing genericity)
Eric Hughes <eric.eh9@  2008-03-14 10:51:25 
Re: User-defined type attributes (replacing genericity)
"Dmitry A. Kazakov&q  2008-03-14 19:58:18 
Re: User-defined type attributes (replacing genericity)
"Randy Brukardt"  2008-03-14 23:01:56 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-14 11:04:33 
Re: User-defined type attributes (replacing genericity)
Eric Hughes <eric.eh9@  2008-03-14 13:19:47 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-16 21:38:37 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-17 16:03:10 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-17 14:58:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 27 17:40:14 CDT 2008.