Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Recap: The Future of Perl 5

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


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

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.

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

    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://1221020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found