Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: f39662ded35a88796df79cdc27051baa33904587
      
https://github.com/Perl/perl5/commit/f39662ded35a88796df79cdc27051baa33904587
  Author: Karl Williamson <[email protected]>
  Date:   2026-02-28 (Sat, 28 Feb 2026)

  Changed paths:
    M regen/embed.pl

  Log Message:
  -----------
  embed.pl: Restrict and document names reserved for Perl use

Currently, the Perl project effectively assumes that ending a name in an
underscore means it will not conflict with any names XS code might use.
This has never been documented.  And there are large XS projects that
make similar assumptions, and so clashes may actually ensue.

We should not be creating new names that make this undocumented
assumption.

One reason the trailing underscore paradigm tends to get used is that it
unobtrusively modifies the name.  It's the same reason the Perl language
has constructs like

    $a += 5 if foo

using postfix "if".  The important part is first with the qualifier
last.

Names like "Perl_foo" or "PL_bar" are just the opposite.  The important
part is the "foo" or "bar", which describe the action.  "Perl_" and
"PL_" are syntactic anti-sugar.  They are necessary but slow down
comprehension of what is intended.

I'm proposing to add and document two postfix modifiers for symbols that
are visible to XS code but undocumented by us.  New code should use
these; existing code can be gradually converted.

I'm proposing suffixes

    _pl_
    _PL_

that we document as being reserved for perl use.  That carves out a
relatively small (but still infinite) portion for our use of the
universe of names that end in underscore.  It paradoxically both
restricts what we can use, and extends the unwritten understanding of
what is reserved.

There are no spellings like this in metacpan.

This replaces #24003



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to