Re: dynamic loading and unloading of module
Martin DeMello <[email protected]> Tue, 20 Aug 2019 11:22:06 -0700
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <CAFrFfuGgQOTUOUUrzHcRj6-wnyH-vbp0zsBiH4ybritrUso0eA@mail.gmail.com> |
On Mon, Aug 19, 2019 at 3:31 AM Robert Klemme <[email protected]> wrote: > > > On Sun, Aug 18, 2019 at 1:31 PM Chris Roerig <[email protected]> wrote: > >> Hi. You can’t “remove” them but you can replace them by calling the >> factory again. My thought was to stuff the functionality needed into >> dedicated classes and swap that functionality as the need changes. That >> being said, it’s only one way to address the issue. >> > > But note that the object needs to retain the state. That becomes awfully > complex with factory pattern because then you have to feed in the previous > object, replace references - basically it is not factory any more and the > handling becomes quite complex because you are not retaining object > identity - which, it seems to me, is required here. As said, I do not think > factory pattern is the right tool here. > It sounds like what would ideally be needed is something like Forwardable but that lets you change the list of delegates dynamically. martin Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>