Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2003-10-27 09:55:04


On Mon, Oct 27, 2003 at 07:33:16AM -0700, Dave Gomboc wrote:
> > Actually I'd prefer
> >
> > is_proper_subtype< D, B >
> > is_subtype< D, B >
> >
> > but you have to be careful that you reverse the argument
> > order when changing your old code over from is_base_and_derived.
>
> Many different forms specifying one but not the other (ancestor,
> descendent, superclass, subclass, etc.) were rejected due to the ease
> with which a developer could nonetheless misinterpret which argument is
> supposed to go first. (You could trawl the archives for this.)

I can definitely imagine this. I was thinking the same thing and was
going to cite the 'argument order clarity' as one of the advantages to
is_base_and_derived, until I had the epiphany that

   is_subtype< D, B >

is just how C++ forces us to spell

   D::is_subtype<B>

non-intrusively.

Oh, which means I actually prefer the name "is_subtype_of".

It's totally analogous to the non-meta case, e.g.

   contains( aRegion, aPoint )

means

   aRegion.contains( aPoint )

and not the other way around. If contains() were an FC++ full
functoid, we could even write

   aRegion ^contains^ aPoint

Gotta love that infix syntax sugar.

Having said all that, I have no objections to

   is_base_and_derived

and

   is_proper_base_and_derived

I just wanted to share the epiphany.

-- 
-Brian McNamara (lorgon_at_[hidden])

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk