Skip to content
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

Fix ->methods to work with constants (and perl 5.28) #299

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Nov 2, 2017

  1. Fix ->methods to work with constants (and perl 5.28)

    Constants created by ‘use constant’ are store in the stash as scalar
    references, whereas constants created by sub foo () { 42 } are stored
    as subs-in-globs.
    
    Before this commit, $class->mc->methods would return the latter kind
    of constant, and skip the former, unless someone at some point hap-
    pened to take a reference to one of the former before ->mc->methods
    got called.
    
    If we are going to be poking around in stashes like this, then we do
    need to be are of what kind of stuff perl sneaks in there.  Constants
    should not be treated inconsistently because of the internal rep-
    resentation.
    
    Also, if I get my way, most subs will start to be stored in stashes as
    simple coderefs (which saves LOTS of memory), in perl 5.28.
    
    This commit kills two stones with one bird: it handles constants cor-
    rectly (an existing bug) and gets ready for the optimization that I am
    almost certain will make it into perl 5.28.  We don’t need new tests
    for the latter, because my optimization makes existing tests fail.
    
    (For more info on the optimization, see
    <https://rt.perl.org/Ticket/Display.html?id=132252#txn-1500037> and
    also <https://rt.perl.org/Ticket/Display.html?id=129916>.)
    Father Chrysostomos authored and sprout committed Nov 2, 2017
    Configuration menu
    Copy the full SHA
    bd9f07b View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2017

  1. Test explicitly reified constant

    In 5.28, sub b(){2} now creates a shorthand constant the way ‘use
    constant’ has done since 5.10.  So test another, reified constant
    sub as well.
    Father Chrysostomos authored and sprout committed Nov 13, 2017
    Configuration menu
    Copy the full SHA
    f7ceb61 View commit details
    Browse the repository at this point in the history
  2. Make ->mc->methods return an object

    This is just a proof of concept, with one method showing how this
    could be implemented.
    Father Chrysostomos authored and sprout committed Nov 13, 2017
    Configuration menu
    Copy the full SHA
    316a2ca View commit details
    Browse the repository at this point in the history