# New Ticket Created by Vladimir Marek # Please include the string: [perl #128815] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=128815 >
class A is repr<CPPStruct>{ has $x; } I don't want $x mapped to C++ object attribute, I want it to be only part of it's perl 6 representation. I was thinking about adding a trait, something like. multi sub trait_mod:<is>(Attribute $r, :$native-private!) is export(:DEFAULT){} class A is repr<CPPStruct>{ has $x is native-private; } But I'm not enough skilled to implement it :) I was not able to find in CPPStruct.c how to detect that attribute has given trait. So I have tried to disable the warnings diff --git a/src/6model/reprs/CPPStruct.c b/src/6model/reprs/CPPStruct.c index f987734..5c0d6a5 100644 --- a/src/6model/reprs/CPPStruct.c +++ b/src/6model/reprs/CPPStruct.c @@ -235,8 +235,8 @@ static void compute_allocation_strategy(MVMThreadContext *tc, MVMObject *repr_in repr_data->member_types[i] = type; } else { - MVM_exception_throw_adhoc(tc, - "CPPStruct representation only handles int, num, CArray, CPointer, CStruct, CPPStruct and CUnion"); +// MVM_exception_throw_adhoc(tc, +// "CPPStruct representation only handles int, num, CArray, CPointer, CStruct, CPPStruct and CUnion"); } } else { @@ -393,8 +393,8 @@ static void get_attribute(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, MVMint32 real_slot = repr_data->attribute_locations[slot] >> MVM_CPPSTRUCT_ATTR_SHIFT; if (type == MVM_CPPSTRUCT_ATTR_IN_STRUCT) { - MVM_exception_throw_adhoc(tc, - "CPPStruct can't perform boxed get on flattened attributes yet"); +// MVM_exception_throw_adhoc(tc, +// "CPPStruct can't perform boxed get on flattened attributes yet"); } else { MVMObject *typeobj = repr_data->member_types[slot]; That at first seems to work: class A is repr<CPPStruct>{ has $x; method m() { $x //= do { my $s = Supplier.new; $s.Supply; } } } my $x=A.new(); say $x.m(); But now my method does not return Supply.new, but rather A.new; If I replace 'has $x' by 'my $x', it returns what I would expect - Supply.new And I got stuck :) Thank you __ Vlad