From: Mark Wooding Date: Sat, 9 Jun 2018 02:49:35 +0000 (+0100) Subject: doc/intro.tex: Strengthen the argument about C++ a bit. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/commitdiff_plain/4f94eb86e2a250e79f73c16da772c91bf0795708 doc/intro.tex: Strengthen the argument about C++ a bit. --- diff --git a/doc/intro.tex b/doc/intro.tex index f77eed0..3e5e8f7 100644 --- a/doc/intro.tex +++ b/doc/intro.tex @@ -143,10 +143,13 @@ which is unlikely to be what was wanted: `B' prints twice, and the `before' and `after' actions are both in the middle.\footnote{% Of course, one could have arranged to call @|Y::f| before @|X::f| -- but the important point is that one would have needed to \emph{know} that this - was necessary.} % + was necessary. And you still end up with two copies of `B'.} % The problem is that correctly composing behaviour from a collection of superclasses requires knowledge of all of the superclasses involved and how -they're supposed to work together. +they're supposed to work together. Messing with virtual base classes has +eliminated the problem of duplicating @|B|'s state, but has done nothing to +help avoid duplicating @|B|'s \emph{behaviour} -- which is a shame, because +duplicating one without the other is going to end badly. The obvious workaround is to separate the functionality -- here, printing the messages -- from the plumbing, which arranges to do everything in the right