develooper Front page | perl.perl5.porters | Postings from October 2003

Re: perl's internal usage of dTHX; is a bad idea

Thread Previous | Thread Next
Arthur Bergman
October 27, 2003 03:55
Re: perl's internal usage of dTHX; is a bad idea
Message ID:

On Sunday, October 26, 2003, at 01:28  am, Stas Bekman wrote:

> ick Ing-Simmons wrote:
>> Stas Bekman <> writes:
>>> Frankly I don't understand why internally Perl uses functions which 
>>> aren't prototyped with (pTHX_ ...), and call dTHX; instead.
>> XS module API compatibility.
> Yes, but I'm talking about internal calls (not XS) that have my_perl, 
> but not passing it because the callee doesn't accept one 
> (Perl_safesysmalloc is one of those).
> If all internall perl calls were never to use dTHX, PERL_SET_CONTEXT() 
> won't be needed.
>> Most of API _does_ pass aTHX (usually via a macro).
>> An up-to-date list of those that don't would be welcome, there may 
>> now be few enough to replicate those and lead XS writers in that 
>> direction.
> Anybody has an idea of doing this programmatically? Using a simple C 
> code parser that returns all functions that call dTHX and its > variants?

Should be fairly simple using C::Scan or something like that.

It is a easy fix, define a new api that takes pTHX_ and change all the 
internal calls to the new API.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About