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,e044473b43baaf18 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-26 11:16:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.rwth-aachen.de!news-koe1.dfn.de!RRZ.Uni-Koeln.DE!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: automatic tag conversion? Date: Mon, 26 May 2003 18:16:05 +0000 (UTC) Organization: GMUGHDU Message-ID: References: NNTP-Posting-Host: d2-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1053972965 2616 134.91.1.15 (26 May 2003 18:16:05 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Mon, 26 May 2003 18:16:05 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/831)) Xref: archiver1.google.com comp.lang.ada:37808 Date: 2003-05-26T18:16:05+00:00 List-Id: Dmitry A. Kazakov wrote: :> The system would always dispatch the most special case, am I right? : : No, Element is of NodeClassAccess which is different from anonymous "access : Node" (that will dispatch). Thus LookProcedure.all is not dispatching at : all. However it will be sort of "class-wide" when NodeClassAccess is : class-wide, as it is. So you practically have everything to make it : working. Just define a wrapper in the same package, where Node is defined: : : procedure Print_Any (Ptr : NodeClassAccess) is : begin : Print (Ptr); -- Dispatches : end Print_Any; Yes. I've made something similar, using a slightly modified set with a generic "look" function, generic with procedure accessor(e: in Element); procedure look(s: in Set); (and also deriving Node from a Printable abstract tagged type, type Printable is abstract tagged private; procedure print(p: access Printable) is abstract; ) Maybe both the Booch components and the Charles library might provide some ideas (in addition to code :) of how iteration can be done. The slight change results in with Sets; with nodes; use nodes; procedure run is -- testing package Node_Sets is new Sets(Element => Node_ptr); net: Node_sets.Set; procedure print_any(n: Node_ptr) is begin print(n.all'access); end print_any; procedure print_all is new node_sets.look(accessor => print_any); begin node_sets.insert(new Transition, net); node_sets.insert(new Place, net); node_sets.insert(new Transition, net); node_sets.insert(new Transition, net); print_all(net); end run; $ ./run a transition a transition a place a transition $ Georg