
On Feb 4, 2008 12:16 PM, Joaquín Mª López Muñoz <joaquin@tid.es> wrote:
Good to know there's a potential for the keyed variant. Would you support then the provision of regular flyweight and also keyed_flyweight as exposed in my prior post?
I support the notion of being able to lookup existing instances by key. However you implement it, I hope it will have an elegant syntax, and an extremely efficient implementation. Remember that this pattern is used often in games and 3D graphics, where extra copies are not an option, regardless of how pretty it makes the code look. Alberto put it nicely when he wrote: "I would keep the "factory" term if you are considering the find/insert approach as an alternative to the current insert-only approach. With that approach case, find() would be given a key, rather than an object. If the object is not found, insert() would have to create an object out of the information stored in the key and that would actually be what factories are expected to do." I intended on doing a review but regrettably don't have time to review this library. Good luck! Your libraries are high quality and I enjoy using them, so I hope Flyweight gets accepted. --Michael Fawcett