From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c1fe4bc1dd51fc87 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: User-defined type attributes Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <30f629fd-69d3-4d40-995f-9933f52b8dad@s37g2000prg.googlegroups.com> <965suhjl0bxt$.74se2ylyksin.dlg@40tude.net> Date: Fri, 14 Mar 2008 10:01:47 +0100 Message-ID: <1t28s8pm6mnmg.gabilv2a3qm3.dlg@40tude.net> NNTP-Posting-Date: 14 Mar 2008 10:01:47 CET NNTP-Posting-Host: d335f2b2.newsspool3.arcor-online.net X-Trace: DXC=^M8;UZT:R5e]l@YUW5NBknMcF=Q^Z^V3h4Fo<]lROoRa8kFo?4eQDfeQ[8j X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:20368 Date: 2008-03-14T10:01:47+01:00 List-Id: On Thu, 13 Mar 2008 20:55:27 -0700 (PDT), Eric Hughes wrote: > On Mar 13, 1:58 pm, "Dmitry A. Kazakov" > 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" 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