Open sanko opened 1 year ago
typedef 'MyClass' => Class[
[ speed => 'set_speed' ] => Method [ [Int] => Void ],
speed => Method [ [] => Int ],
private => [ fuel => Float ],
speed => Int,
driver => Str
];
Something like this? Usage would be something like...
my $car = MyClass->new( speed => 0, driver => 'Mike' );
$car->set_speed(100);
print $car->speed;
new( ... )
would take values and return a blessed pointerfuel
would take up space in the pointer but not exposed somehowMethod
s would automatically be made with THIS calling conventions and can be renamed ([ speed => 'set_speed' ] => ...
) to avoid collisionsEdit: In the above examples, MyClass::speed()
would be _ZN7MyClass5speedEv
and MyClass::set_speed($)
would be _ZN7MyClass5speedEi
in Itanium.
As of this comment, C++ class
support includes:
CPPStruct[ ... ]
(borrowing from Raku)MyClass::MyClass
or MyClass::new
which attach to the the proper endpoint through mangling and proper handling of this pointer internallyMyClass::DESTROY
and handled internallyI haven't wrapped a full C++ yet to test how unwieldy that is.
With Itanium mangling somewhat functional, defining and calling
this
methods should be handled internally.