Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: Recap: The Future of Perl 5

by dave_the_m (Monsignor)
on Aug 24, 2018 at 12:09 UTC ( #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 (Abbot) 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
Node Status?
node history
Node Type: note [id://1221020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2019-06-20 21:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (91 votes). Check out past polls.

    Notices?