
"Steven E. Harris" ha escrito:
Joaquín Mª López Muñoz <joaquin@tid.es> writes:
The main difference is that flyweight<T> enforces that *every* flyweight object with the same value will have a pointer to the same internal representation.
Isn't this usually called "intern", at least when applied to strings?¹ I can see how "flyweight" captures the means of referring to the interned object, but the essential facility here is the interning, not the reference mechanism.
Well, at least in my experience I had never heard of that "intern" terminology. Reading the links you provide, seems to me like the term is used to refer to the factory part of the Flyweight Design Pattern, and the the pattern is somewhat broader than the intern thing only, as it accounts for other participating agents, see for instance. http://home.earthlink.net/~huston2/dp/flyweight.html If you want to see this way, the flyweight<...> class I'm proposing automates the Client part as described in the link above. Anyway, naming discussions aside, do you see value in such a thing being elaborated and eventually proposed to Boost?
Footnotes: ¹ http://www.lispworks.com/documentation/HyperSpec/Body/f_intern.htm http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#intern()
-- Steven E. Harris
Thank you, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo