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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e61c8636ef35379d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-18 16:01:47 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!feeder.via.net!newshub2.rdc1.sfba.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Examples in Docs, was Re: Escape Sequences in Strings References: <3A65DEA1.F90DEE49@mtws.visicom.com> X-Newsreader: Tom's custom newsreader Message-ID: Date: Fri, 19 Jan 2001 00:01:37 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 979862497 24.20.190.201 (Thu, 18 Jan 2001 16:01:37 PST) NNTP-Posting-Date: Thu, 18 Jan 2001 16:01:37 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:4196 Date: 2001-01-19T00:01:37+00:00 List-Id: >can someone tell me exactly what "abstract tagged limited private" >or "abstract tagged limited null record" means? How about some >examples instead? There are several good Ada texts that talk about these things. If one book is unclear to you, another may explain it better. Roughly: "tagged" I can't explain in a short newsgroup post. "abstract" means it's sort of a placeholder. You can't actually declare an object of the type, but you can declare derived types and declare objects of those derived types. In Claw (Class library for Ada on Windows) for instance, Root_Tool_Type is abstract with a private, non-null, record. It has children like Brush_Type and Pen_Type (the Windows "tools"). You can't create an object of Root_Tool_Type, but you can create an object of Brush_Type, Pen_Type, etc. The (private) record for Root_Tool_Type contains stuff, like a Windows handle, that all tools have, while the particular tools like Brushes and Pens contain additional information specific to that kind of tool. Some operations exist only for Brushes, others only for Pens, etc, but some exist for any tool, eg function Is_Attached (Tool : in Root_Tool_Type'Class) return Boolean; "limited" means you can't make copies. Claw.Sockets.Root_Socket_Type is limited, for instance. Life gets complicated if you allow: A,B : Socket_Type; ... Open(A, "1.2.3.4"); B := A; -- is B now a synonym for A or a second socket also -- connected to 1.2.3.4? Close(A); -- Is B still open? (similarly for any "handle" type of thing). If the type is "limited", the compiler will point out that "B := A;" is not allowed. "private" in "abstract tagged limited private" just means "there's some data associated with this, but it's none of your business." The actual record specification comes in the private portion of the package spec. "null record" means "there's no actual data associated with this". So the Root_Tool_Type (above) uses "private" and the actual data includes the Windows handle for the tool. That's private because the application program shouldn't be playing with the Windows tool handle directly while leaving Claw in the dark about the status of the tool handle.