"Pattern Hatching"

Richard A. O'Keefe ok at cs.otago.ac.nz
Wed Nov 27 22:45:16 UTC 2002


Ned Konz <ned at bike-nomad.com> replied:
	Yes, but the original Design Patterns book was like that too. There 
	are patterns in there that are trivial or unnecessary in Smalltalk.
	
	Don't you think that (for instance) the C++ template system and 
	especially its (excessively?) clever use by the STL rates as a more 
	than a bit Heath Robinson-ish? 
	
In '96 or '97 I had a bit of an argument with Stepanov in one of the
newsgroups, might have been comp.lang.scheme or comp.lang.ada.  My point
was that I had Scheme code running faster than heavily optimised
STL-using C++.  (Scheme is a small Lisp dialect.  These days it's noteworthy
for its "hygienic macros", but call-with-current-continuation is also a
rather interesting device.  It has inspired a lot of compiler theory and
development, but is not known for raw speed.)

But if you think the STL's use of templates is Heath-Robinsonish,
try "template meta-programming".  C++ is the only language in wide
use where simply *type-checking* the program is Turing complete...
(In fact all the C++ compilers I have access to are known to reject legal
C++ programs because they cut off template recursion at some level.)

	>     POOF!  An entire pattern disappears up its own fundament if
	> your environment can represent code as data and can run dynamically
	> generated code.
	
	Is this something that would be interesting/useful for your students?
	
	"See how patterns only make sense in their original (often unstated) 
	context: watch how I make this one go away by a different language 
	choice..."
	
Some of the patterns books I have read stress the language-independence
of the patterns.  This turns out to mean "hey, we need it for Java too!"

Yes, I think it would be useful to stress the context a bit more.
GENERATION GAP might make the ideal example.



More information about the Squeak-dev mailing list