Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow CStruct pass-by-value in Nativecall #2648
This is the initial implementation of the pass-by-value
Surely there is no hurry as I will be the only one using this functionality for quite some time. I would like to get feedback on the use of the "is copy" trait to indicate pass-by-value. The advantage of this choice is that it is not already used, and it is already implemented and optimized as part of the Parameter class.
The drawback is that, after analysing the Nativecall MoarVM source code, I start to suspect that 'copying' might be a desirable semantics Perl-side in general, while pass by value is very C-side and specific of CStruct? For this reason, another trait name might be preferable. Of course this is not a problem right now, since all of this is not implemented nor planned, but might be an useful discussion if there will ever be a plan to design a NativeCall 2.0 module.
If anybody is wondering why I closed this,
@jonathanstowe, all, if you want to try this out, or to use it, it is easy, you can find the patch here:
MoarVM needs to be compiled with --has-libffi
Because of this, I wouldn't use this for code that needs to be publicly shared, just yet.