Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2004-04-03 12:47:25


> >> > I do understand that. But I still believe that trait specification is
> > part of
> >> > definition.
> >>
> >> Not if you want to describe the properties of some 3rd-party class:
> >>
> >> #include <3rd_party/smart_ptr.hpp>
> >>
> >> template <class T>
> >> struct is_dereferenceable<third_party::smart_ptr<T> >
> >> : mpl::true
> >> {};
> >
> > I imagine you wouldn't do it 10 times in your code and most definetlety
you
> > wouldn't define it differently in different headers. Most probable you
> > introduce 3rd_party_smart_ptr_wrap.hpp that contains above trait
> > specification and use everywhere instead of 3rd_party/smart_ptr.hpp. So
in
> > this case from my POV you *updated* smart_ptr definition and use this
> > updated definition instead of original one.
>
> So if I write a free function that accepts third_party::smart_ptr<T>
> arguments I'm also updating the smart_ptr definition?

In some rare cases - yes.

> You must have a funny definition of "definition".

Ok. I admit using word definition is at best stretch. But let me give this
imaginary example where I will try to explain what I mean.

Let say for the Project1 we defined a house model like this:

House is a big cube.

Now for the Project1 it was enough and we got away with this "incomplete"
definition. For the Project2 we start working with objects has or has not
windows and doors. So we added following "updates to definition"

House has windows.
House has doors.

So what is above statements in regards to our House model. It's not a [part
of] definition, because definition was done earlier. But it does not mean
that houses we model in Project1 did not have windows or doors. So above two
statements are not part of definition, but part of what House is actually
is.

You may argue that by making additional specification we are essentially
defining new model: House with doors and windows. But I do not see why
should we? smart_ptr is still smart_ptr even though you added statement that
it is dereferenceable. It was dereferenceble by definition, you just did not
have means to ask it before.

Ok, above is most probably is just a gibberish. After all it's not that
important how you look at this. You may as well consider traits as
representative of the orthogonal to models definitions universe of concepts
and categories. Or may be it just somewhere in intersection.

Gennadiy.


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