develooper Front page | perl.perl6.users | Postings from February 2020

Hash Constraints w/in subset's

Thread Next
From:
Paul Procacci
Date:
February 1, 2020 08:58
Subject:
Hash Constraints w/in subset's
Message ID:
CAFbbPuj6og5h9ZpwntRGKzKH1L8dXF1-uWXErhhb=aV6S3r++w@mail.gmail.com
Hey ladies/gents,

How would one go about defining a subset of a Hash who's key's and values
are both constrained by something ....

I've read https://docs.perl6.org/type/Hash and it does make mention of
constraining keys and values, but not within the context of a subset.
Before I go ripping my hair out, I want to make sure I'm doing things right.

For instance, what if I want to define a subset that uses a Hash as it's
base class, in which I want to add the constraint that it's keys must be
strings yet it's values are constrained to only accept Int's?

Thanks in Advance!

-- 
__________________

:(){ :|:& };:

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