I turn to some design pattern questions, and I looked at the definition and examples of the Decorator pattern in GoF. It says:
Attach additional responsibilities to the object dynamically. Decorators provide a flexible alternative to a subclass to extend functionality.
Here are examples of decorators that use inheritance that is definitely not dynamic.
NetObjectives makes the same error:
http://www.netobjectives.com/PatternRepository/index.php?title=TheDecoratorPattern
A discussion of the vault in the Portland Restorer Decorator indicates that there is confusion about what is and is not a decorator.
http://c2.com/cgi/wiki?DecoratorPattern
Wikipedia has some idea of this contradiction, noting that the delegate inside the Decorator needs to be set at build time (other DI methods will also work)
http://en.wikipedia.org/wiki/Decorator_pattern
All examples of the Decorator template (in Java or C ++) require a static construct, either through inheritance or by implementing an interface. An explanation in GoF says that additional responsibilities are applied dynamically. But this is simply wrong.
The comments in PPR speak of dynamic languages that can add methods at runtime, but Java and C ++ are not dynamic, and Decorator's explanation does not say that it is limited to dynamic languages such as Groovy and Lisp.
Was there a correct explanation for Decorator to say that in languages that do not support dynamic method creation, both static and diamantic constructions are involved?
Is the GoF explanation simply wrong, as shown in their own examples, or didn’t I understand something?