On 2004-05-14, at 11:07:35 +0200, Rafael Garcia-Suarez wrote:

> Tassilo von Parseval wrote:
> > > > > Hmm, maybe this means that a _new_ macro should be added for XS
> > > > > writers, that get DEFSV right, by testing whether there's a lexical $_
> > > > > in scope. Opinions ?
> > > > 
> > > > Well, yes, please! Ideally, it would be backwards-compatible so that
> > > > people could already start using it now (unless of course they
> > > > deliberately want $::_).
> > > 
> > > That's the job of PPPort, isn't it.

:-)

I'm working on it. On some sort of autogenerated test-suite,
to be exact. And doing so reveals a couple of small problems,
one of which is following...

> > For instance. But pre-blead perls have no concept of lexically scoped $_
> > so it would make no sense to look for one on the pad. So those macros
> > would therefore look different on older perls (they'd simply expand to
> > DEFSV).
> 
> Something like that maybe : (I don't quite like the name "UNDERBAR" but
> I haven't found anything shorter)
> 
> for perl >= 5.9.1 :
> 
> #define dUNDERBAR I32 padoff_du = pad_findmy("$_")

Perl_pad_findmy() is not (yet?) a member of the public API.
Thus, the pad_findmy wrapper macro isn't defined for XSUBs.

I think we either have to make it part of the public API,
so embed.fnc will take care of the rest, or explicitly use
Perl_pad_findmy().

> #define UNDERBAR ((padoff_du == NOT_IN_PAD \
>           || PAD_COMPNAME_FLAGS(padoff_du) & SVpad_OUR) \
>       ? DEFSV : PAD_SVl(padoff_du))
> 
> For older perls :
> 
> #define dUNDERBAR /**/
> #define UNDERBAR DEFSV
> 
> Defining a dUNDERBAR macro has the advantage that the pad_findmy lookup
> is done only once. In a XSUB lexical scoping isn't likely to change.

-- 
Factorials were someone's attempt to make math LOOK exciting.

Reply via email to