Skip to content

DRAFT: perl.h - add nice aliases for PERL_DEB() and PERL_DEB2() #22986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

demerphq
Copy link
Collaborator

This patch adds PERL_IF_DEBUGGING() as an alias for PERL_DEB() and and adds PERL_IF_DEBUGGING_ELSE() as an alias for PERL_DEB2(). (Thanks to mauke for the names.) It also documents them, along with PERL_DEBUG() and DEBUG_r() and friends.

Currently I have not switched the existing PERL_DEB() or PERL_DEB2() calls to use the new names. I wanted to get feedback on this first.

  • This set of changes requires a perldelta entry, but it is not included yet.

@demerphq demerphq force-pushed the yves/add_nicer_PERL_DEB_aliases branch 2 times, most recently from 37c9c9a to 26f43ba Compare February 10, 2025 15:31
@tonycoz
Copy link
Contributor

tonycoz commented Feb 11, 2025

Looks good to me, and the names are clearer than the originals.

This patch renames PERL_DEB() to PERL_IF_DEBUGGING() and renames
PERL_DEB2() to PERL_IF_DEBUGGING_ELSE(). It also documents them, along
with PERL_DEBUG() and DEBUG_r() and friends.

I have switched the existing PERL_DEB() or PERL_DEB2() calls to use the
new names, but kept aliases for the old names just in case they are used
out in the wild (eg CPAN).

Thanks to mauke for the name suggestions!
@demerphq demerphq force-pushed the yves/add_nicer_PERL_DEB_aliases branch from 26f43ba to 0614b1e Compare February 12, 2025 01:40
@bulk88
Copy link
Contributor

bulk88 commented Mar 31, 2025

How about PERL_DBIF or PERL_DBELIF or PERL_DB_ELF. Tokens PERL_IF_DEBUGGING and PERL_IF_DEBUGGING_ELSE will make alot of lines of code blow past the 80 char line limit and introduce more very complicated or no good-practice-exists indenting and line wrapping. Full blown sentences s/ /_/g and self-documenting tokens are a bad idea. API docs exist for a reason. I think any kind any spelling shorter tokens are better than the proposed PERL_IF_DEBUGGING and PERL_IF_DEBUGGING_ELSE. I have no opinion on the exact spelling of new and improved shorter versions of PERL_DEB/PERL_DEB2.

token PERL_DEB2(a,b) isn't well named IMO, not obv until greping what it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants