|
Boost : |
From: Itay Maman (itay_maman_at_[hidden])
Date: 2002-06-30 16:28:49
Andrei Alexandrescu wrote:
> "Itay Maman" <itay_maman_at_[hidden]> wrote in message
> [snip]
>
> Good work. Some short comments on the code:
>
> * It's unfit that in the spaceship era, new Boost code has to still
> define useful tools such as Int2Type, Type2Type, and Select. They
> should be first-class Boost citizens.
>
Well, the code is a first draft which needs to be boostified.
Specifically, the usage of general-purpose primitives such as int2type
or select.
> * Stack_holder::assign is really Stack_holder::init.
I am not sure I am following you. What do you mean by Stack_holder::init?
>
> * I see stack_holder has two pointers to function per object, isn't
> that wasteful?
Yes it is wasteful. I am planning on replacing it with a metarecursive
function, as suggested by Doug.
>
> * You say Variant-to-Variant copying is done through visitation, but
> the infrastructure (Variant_to_variant_copier,
> assign_variant_to_variant, Assign_helper) doesn't look like a visitor.
> Actually I'm not sure I understand the copying process; isn't it
> obscure and unnecessarily complex? The code dedicated to copying in my
> last article on Variant is considerably shorter, basically a class
> that implements a Visitor interface.
>
That depends on what is considered to be a visitor. conceptually
speaking, Variant_to_variant_copier is a visitor which visits a given
host (the source variant).
Regarding the design of the copying process: I can express copying in
terms of visitation but not the other way around. Implementing a
dedicated copying mechanism would cause some (unnecessary) code
duplications.
> * Variant has a per-object overhead of one integer plus two pointers
> to functions. Shouldn't the approach with one integer be more
> appropriate?
>
> I need to stop here, but by and large the implementation looks a tad
> more complicated than it could be. It might be well the case that that
> is because of support for incomplete types.
>
> Also, especially when you copyright some work, it is nice to take the
> time and give credit to other material (copyrighted or not, and
> especially copyrighted) that served you as influence or inspiration. I
> don't know if and to what extent Loki, the original Variant paper, the
> article series in CUJ, or other work, served as a starting point for
> your code, but if they did, it would be nice to mention them.
>
>
I feel a bit awkward, since I had no intention of not giving the
appropriate credits. My first post
(http://lists.boost.org/MailArchives/boost/msg30415.php) in a discussion
that went on about 3 weeks ago does specify your article as the main
source. I am planning to mention this article (and Loki) in the
documentation, but nonetheless, your comment is correct: I should have
mentioned the relevant material in the source code itself. Will be fixed
shortly.
-Itay
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk