On Mon, Jan 2, 2017 at 11:11 PM, ToddAndMargo <toddandma...@zoho.com> wrote:

> When using "Inline", do you have to convert arrays to
> references first?
>

Can you provide a specific example?

My basic rule is "if you are calling something p5ish from p6, if it expects
an arrayref you give it an array (which will be passed as a p5 arrayref)
and if it expects a list you probably need to slip it with |". Perl 5 code
is still Perl 5 code, and the Perl 5 sub calling convention flattens
everything into a single list unless you've told it otherwise with a
prototype (and even then it will force an arrayref, because the actual
calling convention still uses a flat list); this cannot be changed without
altering the guts of Perl 5 in ways that are quite beyond Inline::Perl5 or
any other possible plugin. Perl 6 can be thought of as considering an array
or hash or etc. as a reference unless told otherwise (which is why there is
prefix:<|> or .slip, for those cases when you need to tell it otherwise).

(I haven't checked, Inline::Perl5 may actually slip for you if it knows it
needs to; XS provides an API to determine the prototype of a function.)

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Reply via email to