develooper Front page | perl.perl5.porters | Postings from March 2023

Re: Questions about the my Foo $var syntax

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 13, 2023 12:46
Subject:
Re: Questions about the my Foo $var syntax
Message ID:
ZA8bJAmeOOdtvEhT@iabyn.com
On Mon, Mar 13, 2023 at 11:29:40AM +0000, Robert Rothenberg wrote:
> 3. if not, are there plans to do something useful with it, e.g. enforce type
> constraints?

It can be used to enforce some compile-time and run-time constraints on
what keys are valid in a hash being used as an object. This can be set up
using the fields pragma.

But it's generally underused. It was added then mostly forgotten about.
Whoever added it may have had some grand visions of where they intended to
go with it, but that generation of perl core hackers are all long gone.

-- 
The Enterprise successfully ferries an alien VIP from one place to another
without serious incident.
    -- Things That Never Happen in "Star Trek" #7

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About