in reply to Re^10: Confused as to why the "casting context" is mis-behaving (clinging)
in thread Confused as to why the "casting context" is mis-behaving

I'm talking about what happens when return @array; gets run. return @array; is not implemented using XS macros.

And Perl has special handling for dealing with (just) XS code that behaves badly and returns more than one item when called in a scalar context (I even mentioned this specifically previously -- probably in a prior thread about this ever-returning topic but one I re-read recently).

but somehow I find it unlikely

Yeah, I just make all this stuff up. For Python's sake, just go look at the source code if you think I don't know what I'm talking about. Wow, cling much?

Here, the array IS returned from the function :)

Um, actually, a single reference is returned from the function and the fact that the function was predeclared :lvalue means that the caller adds code to dereference that reference. But nice last stab at trying to cling just a little more. q-:

- tye        

Replies are listed 'Best First'.
Re^12: Confused as to why the "casting context" is mis-behaving (clinging)
by andal (Hermit) on Oct 29, 2010 at 09:49 UTC

    Well. You have it right. I do know only how the XS functions are interfaced with perl and I base my assumptions on this knowledge. I'm not going to check perl sources to see if perl has different stack discipline for pure perl functions. After all it is not important for me since I write either in perl or extensions for perl. And if you know how the things are really handled, fine with me. It does not affect my work, for perl programs it makes no difference how the internal stack is handled :)

    The example of a way to return array from the function was not a way to "cling". This whole discussion has started after your statement, that there's no way to return an array in perl. So I just gave an example when the array is returned from the function. Whatever internal steps are done for this are not of a concern for me at this point. In our arguing about how things are done internally we have forgotten, why the arguing has started in the first place :)