comp.lang.ada
 help / color / mirror / Atom feed
From: Jano <nono@celes.unizar.es>
Subject: Re: Persistence of limited tagged types
Date: Tue, 8 Apr 2003 00:09:33 +0200
Date: 2003-04-08T00:09:33+02:00	[thread overview]
Message-ID: <MPG.18fc158bd901913d9896db@News.CIS.DFN.DE> (raw)
In-Reply-To: 1049742443.855336@master.nyc.kbcfp.com

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
-------------------------



  reply	other threads:[~2003-04-07 22:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-07 12:47 Persistence of limited tagged types Jano
2003-04-07 14:47 ` Nick Roberts
2003-04-09 10:05   ` Nick Roberts
2003-04-10  3:32     ` tmoran
2003-04-09 23:09   ` Matthew Heaney
2003-04-10 14:40     ` Nick Roberts
2003-04-10 23:37       ` Robert A Duff
2003-04-11 16:39         ` Nick Roberts
2003-04-10 18:49     ` Randy Brukardt
2003-04-10  1:12   ` Matthew Heaney
2003-04-07 18:11 ` Stephen Leake
2003-04-07 19:07   ` Hyman Rosen
2003-04-07 22:09     ` Jano [this message]
2003-04-08 13:58       ` Matthew Heaney
2003-04-10 11:41         ` Julio Cano
2003-04-10 19:14           ` Jano
2003-04-11 12:54             ` Julio Cano
2003-04-07 20:17   ` Robert Spooner
2003-04-07 21:14     ` Stephen Leake
2003-04-08 12:56       ` Robert Spooner
2003-04-08 13:41         ` Jano
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox