GabrielDosReis/ipr

How to represent Base_type expansion

Closed this issue · 4 comments

Consider:

template <typename... T>
struct X : T... {};

This is not representable in IPR at the moment.
Expansion operates on Classic expressions. Base_type is a declaration and bases are Sequence<Base_type>.

This issue will interplay with #65

Base_type takes the type to be used as base type as argument -- see also Class::declare_base().

In your example, T... is an expansion, so you get the expression Expansion [operand: As_type [expr: T]], which can you can now use as operand to As_type to get a type used as base type. E.g.

Base_type [base: 
   As_type [expr: 
       Expansion [operand: 
           As_type [expr: T]
       ]
   ]
]

Which part is not representable in IPR at the moment?

This would be possible if Expansion would take an Expr as an operand.
At the moment, it is limited to just Classic expressions. As_type is not a Classic expression

This would be possible if Expansion would take an Expr as an operand.

The definition of Expansion says that it is a Classic unary structure that takes a general Expr as operand.

   struct Expansion : Unary<Category<Category_code::Expansion, Classic>> { };

The factory function make_expansion() takes a const ipr::Expr&

Am I reading that wrong?

Yes. You are right. I was reading the definition wrong :-)