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-Thread: 103376,243dc2fb696a49cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: Brian May Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) References: <1700922.2nPlMsa4Ny@linux1.krischik.com> <1636756.M7hCqjsVMv@linux1.krischik.com> <415c36c0$0$91010$39cecf19@news.twtelecom.net> <4c2ec8a8.0410012335.dcf9001@posting.google.com> Date: Sat, 02 Oct 2004 20:00:05 +1000 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:3q+zl5BReNlHTHu/ruvNnqTSovs= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: dsl-202-173-153-89.vic.westnet.com.au X-Trace: news.melbourne.pipenetworks.com 1096711194 202.173.153.89 (2 Oct 2004 19:59:54 +1000) X-Complaints-To: abuse@pipenetworks.com X-Abuse-Info: Please forward all headers to enable your complaint to be properly processed. Path: g2news1.google.com!news1.google.com!sn-xit-04!sn-xit-06!sn-xit-14!supernews.com!sjc1.usenetserver.com!c03.atl99.usenetserver.com!news.usenetserver.com!news02.tsnz.net!newsfeed01.tsnz.net!news.xtra.co.nz!news.mel.connect.com.au!news-north.connect.com.au!news-south.connect.com.au!news.alphalink.com.au!news.melbourne.pipenetworks.com!not-for-mail Xref: g2news1.google.com comp.lang.ada:4554 Date: 2004-10-02T20:00:05+10:00 List-Id: >>>>> "K" == K writes: K> dbmap order_map; K> order_map.insert("ORDER.NUMBER", &Order::number) K> .insert("ORDER.CUSTOMER", &Order::customer_number) K> .insert("ORDER.ACCEPTED", &Order::acceptance_date) K> .insert("ORDER.PROMISED", &Order::promised_ship_date) K> ... K> and then be able to write: K> Order order; K> order_map.read(dbreader, order); K> order.promised_ship_date = ship_date(order.line_items); K> order_map.update(dbconnection, order); Hmmmm... Thinking aloud: One approach that might work, at least for some applications: declare type Index_Type is (Number, Customer_Number, Acceptance_Date, Promised_Ship_Date, ...); begin insert(Order_Map, Number); insert(Order_Map, Customer_Number); insert(Order_Map, Acceptance_Date); insert(Order_Map, Promised_Ship_Date); ... end; ... declare type Order is array (Index_Type) of ???? begin Read(Order_Map, dbreader, Order); Order(Promised_Ship_Date) := ship_date(order.line_items); Update(Order_Map,dbconnection, Order); ... end; (not tested; syntax may not be exactly correct) The obvious problem with this is that all values need be the same type. I am not sure if your code has this limitation or not. Perhaps you could solve this with using a tagged type and inheritance. I have a vague feeling this won't work; you can't have an array of unconstrained types... -- Brian May