Boost logo

Boost :

Subject: Re: [boost] Hana Views and References
From: Lee Clagett (forum_at_[hidden])
Date: 2015-06-23 23:33:15


On Tue, Jun 23, 2015 at 5:36 PM, Joel de Guzman <djowel_at_[hidden]> wrote:
>
> So the question is: will Hana support references without
> resorting to using reference wrappers? I do appreciate
> the FP nature of Hana, but please be reminded that we're
> in C++.
>
> I also recall some discussion that Hana also does not support
> Fusion-like lightweight views. Is there a plan to support them?
>
> I haven't fully investigated yet what else Hana does not support
> that Fusion does, but at least these two important aspects of
> fusion come to mind. At the very least, I don't think Hana should
> advertize itself as a superset of Boost.Fusion. Faster runtime
> performance is also questionable, when lightweight views and
> reference members come into play.
>
>
Hana has an adaption layer for boost fusion, that has no documentation.
This adaption code could use some work - it should be able to use fusion
traits for more generic adaption, making all fusion sequences (including
views and adapted structs) compatible with Hana. `concat_impl` could return
a sequence-view (currently it moves/copies elements into a new sequence),
`remove_at_impl` (not currently implemented) could use
`fusion::filter_if<>` to avoid element moving/copying, etc. I think this
could be useful in a number of scenarios similar to the transform in place
discussion from another thread.

I'm not sure that Hana should provide this view functionality directly, but
it seems like it should list these differences in the documentation. In
fact, should Hana leverage fusion::tuple instead of its own tuple
implemention (Fusion is undergoing a C++11 upgrade so compilation time
difference should be negligible)? Something to consider since it looks like
multiple tuple implementations are going to be maintained in boost.

Lee


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