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.8 required=5.0 tests=BAYES_00,URI_HEX autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6eac62e4f2badf3a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-07 15:09:10 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!fu-berlin.de!uni-berlin.de!212.97.175.23!not-for-mail From: Jano Newsgroups: comp.lang.ada Subject: Re: Persistence of limited tagged types Date: Tue, 8 Apr 2003 00:09:33 +0200 Message-ID: References: <1049742443.855336@master.nyc.kbcfp.com> NNTP-Posting-Host: 212.97.175.23 X-Trace: fu-berlin.de 1049753348 9229342 212.97.175.23 (16 [49872]) X-Newsreader: MicroPlanet Gravity v2.50 Xref: archiver1.google.com comp.lang.ada:35977 Date: 2003-04-08T00:09:33+02:00 List-Id: Hyman Rosen dice... > Stephen Leake wrote: > > You will have to write a function that reads the external > > representation of the tag, allocates an object of the appropriate > > type, and returns the pointer. Yes, this function must be changed > > every time you add a new tag. > > This is known as the Factory pattern. Instead of changing the > function for each new tag, you can have the package that defines > the type enroll a read method into a table of methods. Then the > factory reads the external tag representation, looks it up in > the table, and calls the method if it's present. I like this solution. With very little overwork. -- ------------------------- Jano 402450.at.cepsz.unizar.es -------------------------