Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Recap: The Future of Perl 5

by dave_the_m (Monsignor)
on Aug 24, 2018 at 11:02 UTC ( [id://1221010]=note: print w/replies, xml ) Need Help??


in reply to Re: Recap: The Future of Perl 5
in thread Recap: The Future of Perl 5

However, other than checking that a package "Foo" exists, core Perl doesn't do anything with that.
It's used for compile-time and run-time checking of the keys to hash refs. It's the mechanism that fields.pm uses.

Dave.

Replies are listed 'Best First'.
Re^3: Recap: The Future of Perl 5
by tobyink (Canon) on Aug 24, 2018 at 11:40 UTC

    Hmm, interesting. Do you know how much of that is in the core Perl (as Ovid is using the term "core"… perl.exe itself, no modules), and how much is done by fields.pm and friends?

    If it's mostly done by the modules, then I don't see a problem with there being multiple ways of hooking into my Foo $x. TIMTOWTDI after all.

      It's built into the perl executable itself:
      BEGIN { %Foo::FIELDS = qw(a 1 b 1) }; my Foo $x = {}; $x->{c} = 1; # compile-time error
      fields.pm just populates the field hash

      Dave.

        Interesting. I guess this explains the limitation with Lexical::Types where it allows you to define, say, my Str $x to do something else other than check $x is a blessed Str object (and I've started to explore that possibility using Lexical::TypeTiny), but still requires there to be a Str package defined. I guess Perl needs that package to exist so that it can look for %FIELDS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1221010]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found