Re: [perl #131599] [RFC] Allow a Callable for `is default` that will generate default values

2018-07-20 Thread Elizabeth Mattijsen via RT
FWIW, with: http://modules.perl6.org/dist/Hash::Restricted:cpan:ELIZABETH one can restrict access to a hash to a certain set of keys: use Hash::Restricted; my %h is restricted = a => 42, b => 666; # restrict to keys at initialization my %h is restricted; # restrict to keys a, b, c > On

Re: [perl #131599] [RFC] Allow a Callable for `is default` that will generate default values

2018-07-20 Thread Elizabeth Mattijsen
FWIW, with: http://modules.perl6.org/dist/Hash::Restricted:cpan:ELIZABETH one can restrict access to a hash to a certain set of keys: use Hash::Restricted; my %h is restricted = a => 42, b => 666; # restrict to keys at initialization my %h is restricted; # restrict to keys a, b, c > On

[perl #131599] [RFC] Allow a Callable for `is default` that will generate default values

2018-07-20 Thread Alastair Douglas via RT
On Mon, 19 Jun 2017 09:30:41 -0700, brad wrote: > The way Moose in Perl 5 works around this is to give it a subroutine > there currently isn't as far as I know, a way to do what you intended. I'd like this feature as well. I was in IRC asking about whether we could restrict a hash in the same wa

Re: MAIN subroutine

2018-07-20 Thread JJ Merelo
In general, it needs to be improved. https://github.com/perl6/doc/issues/2167 Please add to that issue or open another one to comment this specific fact. Cheers JJ