develooper Front page | perl.perl5.porters | Postings from December 2013

Re: An article on writing Perl extensions without XS

Thread Previous | Thread Next
From:
Christian Walde
Date:
December 17, 2013 11:08
Subject:
Re: An article on writing Perl extensions without XS
Message ID:
op.w78g8bqnydyjqt@digitizedsqueak
Posting to P5P, because this pertains not only the article, but XS itself:

As i went on reading the article, and playing with the code in the github  
repo, more and more questions about the cryptic names and bizarre  
idiosyncrasies of the code came to me.

Eventually i realized and understood that they were no specific choice in  
implementation, but forced due to the cryptic, bizarre and idiosyncratic  
naming and concepts of XS itself. * Discussion with Zefram in #p5p failed  
to show me any other possible reason, since he himself tentatively agreed  
that the arguments boil down to "tradition".

The trouble with XS macros is that they generally carry names that do not  
actively describe the origin, content or purpose of variables; and to make  
matters worse, have names that are nearly useless as search queries. They  
thus require the dedicated seeker to try and acquire the knowledge of  
which specific box to look in for the explanation of those macros and  
subsequently memorize all of them, simply in order to acquire the ability  
of reading the code. **

This is the exact same trouble that ails magic variables, and could be  
similarly addressed with an appropiately crafted `include 'xs_english.h';`.

I'm willing to do this experiment, however my experience and exposure to  
XS is limited, so i am thinking i will just do it in the repo of the code  
to this article.

-- 
With regards,
Christian Walde

* A very simple and hopefully extremely clear example is the variable  
`items`. It is, exceptionally, an english word in XS, whose meaning can be  
guessed. However even so, that's only a guess. A simple renaming to  
sub_arg_count would make it entirely unnecessary to guess.

** And as we all know, code should be written such that the next person  
damned to maintaining it can read it with least effort.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About