3 ms·
> other times, they have none (e.g. the Flyweight pattern). They could've called it “handrolled hash consing”, which is exactly what it is.
by catnaroek 10y ago
> other times, they have none (e.g. the Flyweight pattern).
They could've called it “handrolled hash consing”, which is exactly what it is.
- comex 10y agoI don't think that's much better than Flyweight in terms of intrinsic meaning. A little better, since it breaks down into hash + consing, but having not heard of either before, I wasn't able to easily guess what it was despite knowing what hashes and cons cells are. Of course, like everything else in Lisp it predates GoF, so I suppose it would have been nice to reuse existing jargon... But maybe a better name would be "memoized construction".
- catnaroek 10y ago“Memoized construction” is a very good name, indeed. It's actually better than “hash consing”, because it isn't tied to a particular implementation strategy. But I think the “handrolled” part is also important, to stress that it isn't something the language implementation gives you for free.