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: a07f3367d7,c7ff90b15f15636c X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail From: Colin Paul Gloster Newsgroups: comp.lang.ada Subject: Re: Runtime type selection Date: Tue, 13 Oct 2009 10:45:41 +0000 Organization: A noiseless patient Spider Message-ID: References: <2c15c8a6-b555-4d08-8fe6-f77cb207e7a6@k33g2000yqa.googlegroups.com> <1fv6ippku9z2n$.rbm60r20961$.dlg@40tude.net> Reply-To: Colin Paul Gloster Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: news.eternal-september.org U2FsdGVkX187xDjAa17UMoM1ATKBrb1/CbsxtUTBT38ojSTJer4slWH50JybT/j3QW/yV5CyaM4CuJa+YKHfCpid4gNxB9MDjKOxU0ZIuvmXZil0tvZDQm/3GXQzqLVsLjLyd76jjDRYuUcf8q4uHi4m0NnZGeqf6vGNnvlw8mg= X-Complaints-To: abuse@eternal-september.org NNTP-Posting-Date: Tue, 13 Oct 2009 09:45:49 +0000 (UTC) In-Reply-To: <1fv6ippku9z2n$.rbm60r20961$.dlg@40tude.net> X-Auth-Sender: U2FsdGVkX19v/Fm3HcmNkmN5bpK84iGXVn4lBu39LNt3xvlUUfltxkYwpD19TcYMXBd2gne3/uk= Cancel-Lock: sha1:hrq/yh7lPMCs1s0jCjJMd3QLqLw= X-X-Sender: Colin_Paul@Bluewhite64.example.net User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) Xref: g2news2.google.com comp.lang.ada:8694 Date: 2009-10-13T10:45:41+00:00 List-Id: On Sun, 11 Oct 2009, Dmitry A. Kazakov wrote: |----------------------------------------------------------------------------| |" | |On Sun, 11 Oct 2009 09:41:54 -0700 (PDT), xorque wrote: | | | |> I'd like to develop a program that processes a graph. The contents of | |> the graph are a random selection of objects of different types (all | |> elements may be of the same type or may all be different - assuming | |> there are enough types defined). By 'type' in this case, I am | |> referring to Ada types. | |> | |> The basic problem is that I want to create an object of a type picked | |> at random, at runtime. I'm not entirely sure what my options are here. | | | |The problem is that graph nodes have nothing in common. Thus there is | |nothing except for the graph traversal operations you could implement on | |the graph as a whole. | | | |[..]" | |----------------------------------------------------------------------------| You made it sound as if a Visitor Pattern might work.