When I wrap a simple class like this:
struct ProductType
{
string value;
alias value this;
}
wrapAggregate!(ProductType);
The compiler report error:
../../.dub/packages/autowrap-0.6.2/autowrap/pyd/source/autowrap/python/wrap.d(266,25): Error: no property length for type symmetry.carbon.client.CarbonClient.ProductType
../../.dub/packages/autowrap-0.6.2/autowrap/pyd/source/autowrap/python/wrap.d(98,9): Error: template instance autowrap.python.wrap.Lengths!(ProductType) error instantiating
source/symmetry/carbon/pyd_manual.d(47,5): instantiated from here: wrapAggregate!(ProductType)
Here is the relevant code at file pyd/source/autowrap/python/wrap.d line 266
261 private template Lengths(T) {
262 import pyd.pyd: Len;
263 import std.meta: AliasSeq;
264
265 static if(is(typeof(T.init.length)))
266 alias Lengths = Len!(T.length);
267 else
268 alias Lengths = AliasSeq!();
269 }
So we can see the compiler complain for line 266 that it cannot find length method for T. I think this is because the alias this confused compiler. And there should be a simple solution I think, in this case we do not even need len() python method in the worst case.
When I wrap a simple class like this:
wrapAggregate!(ProductType);
The compiler report error:
../../.dub/packages/autowrap-0.6.2/autowrap/pyd/source/autowrap/python/wrap.d(266,25): Error: no property length for type symmetry.carbon.client.CarbonClient.ProductType
../../.dub/packages/autowrap-0.6.2/autowrap/pyd/source/autowrap/python/wrap.d(98,9): Error: template instance autowrap.python.wrap.Lengths!(ProductType) error instantiating
source/symmetry/carbon/pyd_manual.d(47,5): instantiated from here: wrapAggregate!(ProductType)
Here is the relevant code at file pyd/source/autowrap/python/wrap.d line 266
So we can see the compiler complain for line 266 that it cannot find length method for T. I think this is because the alias this confused compiler. And there should be a simple solution I think, in this case we do not even need len() python method in the worst case.