A blog post sounds good. More people should know about this issue --
even if you don't find fixing legacy code to be worth the bother, it
*is* good to know enough not to write new code with reserved names. And
p5p, etc., will then be free to give the current issues in the Perl
source whatever priority they see as appropriate.
As context, the C standards reserve certain names to the
"implementation", which means the compiler implementation, including the
C libraries. Your own applications and libraries are not allowed to use
reserved names. These names were reserved back before namespace issues
were well understood. In many cases there are unnecessarily overbroad
and can be called mistakes, but they are mistakes that we are stuck
with. I personally find the bans on E[A-Z0-9]*, is[a-z]* and to[a-z]*
all to be real nuisance. If you have a variable named "token", you are
using reserved namespace, and an implementation upgrade could cause
unspecified behavior as a result. Or how about the "stream_state"
variable? Banned -- str[a-z]* is reserved for new string functions. The
GNU docs summarize them nicely here
<http://www.gnu.org/software/libc/manual/html_mono/libc.html#Reserved-Names>.
The full list is hard to memorize and C programmers, even at the highest
skill level, often ignore them. Before Jean-Damien created it at my
request, there was (as far as I know) no tool to detect violations. I
was aware of these issues, and believed that I was writing Marpa to be
fully compliant, but c2ast.pl found many issues I'd missed.
So a blog post would be a real service.
-- jeffrey
On 12/24/2013 07:08 AM, Durand Jean-Damien wrote:
Jeffrey,
Nice idea, I'll do so, guessing that posting to blogs.perl.org
<http://blogs.perl.org> could have a better and perhaps more
appreciated audience than directly to p5p or perlbug (?).
Thanks / JD.
2013/12/24 Jeffrey Kegler <[email protected]
<mailto:[email protected]>>
[ Off-line from the group ] An exercise which might help the Perl
community (and in the process bring attention to c2ast), would be
to run a c2ast.pl <http://c2ast.pl> --check reservedNames on the
Perl source, and submit it to perl5-porters (or perlbug?).
[...] Cleaning up the namespace will be hard -- the Perl source
intrudes on the reserved namespace heavily. And many people may
not realize the reason to keep the namespace clean -- it'll seem
like a lot of work to deal with something that is not an issue.
I'm emailing you direct off-line because you're the obvious
first-choice to do this. If you like the idea, reply back into
the main list. Otherwise, I may throw this open to the list as a
"Target of Opportunity".
-- jeffrey
--
You received this message because you are subscribed to the Google
Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "marpa
parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.