|
Proto : |
Subject: Re: [proto] Defining the result domain of a proto operator
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2011-08-26 13:02:58
Le 26/08/2011 17:56, Eric Niebler a écrit :
> On 8/26/2011 11:44 AM, Eric Niebler wrote:
>> Proto will
>> compute the domain of m*v to be matrix. It will use matrix_domain's
>> generator to post-process the new expression. That generator can do
>> anything -- including placing the new expression in the vector domain.
>> In short, there is no requirement that a domain's generator must produce
>> expressions in that domain. Just hack matrix_domain's generator.
>
> Expanding on this a bit ... there doesn't seem to a sub-/super-domain
> relationship between matrix and vector. Why not make them both (together
> with covector) sub-domains of some abstract nt2_domain, which has all
> the logic for deciding which sub-domain a particular expression should
> be in based on its structure? Its generator could actually be a Proto
> algorithm, like:
>
> nt2_generator
> : proto::or_<
> proto::when<
> vector_grammar
> , proto::generator<vector_expr>(_)>
> proto::when<
> covector_grammar
> , proto::generator<covector_expr>(_)>
> proto::otherwise<
> proto::generator<matrix_expr>(_)>
> >
> {};
>
> struct nt2_domain
> : proto::domain<nt2_generator>
> {};
>
> Etc...
>
I think you hit it right on the spot. I'll see how to make this
consistent with table and other stuff.
Proto list run by eric at boostpro.com