Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #57123, comment 8


Ignore:
Timestamp:
01/30/2023 05:33:15 PM (23 months ago)
Author:
johnjamesjacoby
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #57123, comment 8

    initial v1  
    33I have a thought about the new method names (`get_current_locale`, `get_current_user_id`). Apologies for it being after-commit 😔 and for maybe digging up an old conversation…
    44
    5 Does `_current_` convey “global state”, even when used within the confines of a class or Namespace?
     5Does `_current_` convey “global state”, even when used within the confines of a class or Namespace? Is it possible a future plugin developer might think of these as simple local-scoped wrappers to return those globals?
    66
    7 Seems like existing global functions that start with `get_current_` or `restore_current_` established a pattern that “current” could be either “switched” or “originating” depending on the caller.
     7Tangentially, existing global functions that start with `get_current_` or `restore_current_` established a pattern that “current” could be either “switched” or “originating” depending on the caller.
    88
    99Is this, perhaps, a decent opportunity to establish a more intentional/explicit/strict naming pattern to differentiate things that are “currently switched” from “reset back to what we started with” ?