Pyd: Stackthreads and returning arrays from D
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Wed Jun 27 02:32:26 PDT 2007
Simen Haugen wrote:
> Ok, I just cannot get it to work..
> Look at this simple example:
>
> import pyd.pyd;
>
>
> class Item {
> }
>
>
> class Container {
> private:
> Item[] _items;
>
> public:
> Item[] items() {
> return _items;
> }
>
> void items(Item[] items) {
> _items = items;
> }
Try:
Item[] items(Item[] items) {
return _items = items;
}
> }
>
>
> extern(C) void PydMain() {
> module_init();
>
> wrap_class!(Item);
>
> wrap_class!(
> Container,
> Property!(Container.items)
> );
> }
>
> When trying to compile this I get an error "expected to return a value of
> type Item[]" for the Container.items property:
[snip]
> When I used stackthreads I had no problem returning array of classes.
I think the error message was for the second method (the setter) which
*didn't* return an Item[] as was expected.
So if I'm correct your only problem with returning an array of classes
was forgetting to do so :P (in the setter).
More information about the Digitalmars-d
mailing list