email@example.com (Andrew Koenig) writes:
> In article <firstname.lastname@example.org> Tony Finch <email@example.com>
> > In the tree example that you started with, what is wrong with just
> > passing round the whole subtree so that it can be compared with as
> > necessary? Any reasonable implementation will only be passing round a
> > pointer so you lose nothing.
> Because it will compare equal with any other subtree that happens to
> have the same structure, which is not what I want.
But in that case, they are not the *same* subtree; they are different
in some way that you haven't bothered to specify.
Unless, that is, you intend to modify the subtree. In my experience,
that is almost never a good thing; the potential confusion of updating
a complex structure in-place seldom is worth the small speed-up (some
years ago I talked with the people who built an optimizing compiler
with all kinds of live-dead analysis, reordering of statements, and
register coloring; and that was their opinion also).
Peter Ludemann +1.415.813.6806 (fax: +1.415.813.7499)
Software Architect firstname.lastname@example.org
InXight Software, Inc. http://www.inxight.com
PAHV 105, 3400 Hillview Ave., Palo Alto, CA 94304