Tying sub arguments is rare?
[email protected] (Ken Fox) Tue, 12 Oct 1999 16:32:32 -0400 (EDT)
| Newsgroups | perl.perl6.porters |
|---|---|
| Message-ID | <[email protected]> |
Chip just made a comment to Ilya on p5p that is vaguely troublesome
to me:
| > > Would you consider passing \$fido to ALLOCATE? It would avoid the
| > > need for some fairly serious pain in Topaz.
| ...
| In Topaz, possession of a Scalar* (old: SV*) is not adequate to tie a
| variable; you need the Scalar** (SV**) so that you can create a new
| TiedScalar (SV with MAGIC) and make the Scalar** point to it.
I understand why this is, but I think I have code that will break.
Here's an example:
sv_setref_iv(ST(2), Window_Package, (IV)root_return);
generated by xsubpp from the following:
int
XGetGeometry(display, d, root_return, ...
Display * display
Drawable d
Window &root_return
Anybody who uses & syntax in an XSUB seems to be at risk -- operations
that change the scalar's representation will break. I've never really
liked the idea of modifying (or worse, transmogrifying ;) apparent
pass-by-value arguments (another victim of Pascal?), but it is deeply
ingrained in Perl.
Is this a problem for XSUBS, user code, both or neither?
What are the time/space trade-offs for allowing modification of
sub arguments? Is it worth doing to improve compatibility with Perl 5?
- Ken
--
Ken Fox, [email protected], (313)59-44794
------------------------------------------------------------------------
Ford Motor Company, Powertrain | "Is this some sort of trick
Analytical Powertrain Methods Department | question or what?" -- Calvin
C3P Implementation Section |