On 2019-12-12 00:22, Fernando Santagata wrote:
On Thu, Dec 12, 2019 at 3:46 AM Todd Chester <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote:

    On 2019-12-11 10:22, Fernando Santagata wrote:
     > File test.pm6
     >
     > unit module test;
     > subset PosInt of Int is export where * > 0;
     >
     >
     > File test.p6
     >
     > use lib '.';
     > use test;
     > sub mytest(PosInt $a) { say $a }
     > mytest(1);     # output: 1
     > mytest(-1);    # output Constraint type check failed in binding to
     > parameter '$a'; expected test::PosInt but got Int (-1)

    Hi Fernando,

    What response do you get back with?

          perl6 -c test.pl6

    -T


I don't understand the reason for your question, but anyway:

$ perl6 -c test.pl6
Syntax OK

--
Fernando Santagata


Hi Frenando,

Thank you!

I was looking to see at what point in the process
the "constraint type" check triggered.

You test showed me that there is no benefit to using
a subset when it comes to trapping the error before
run time.

Another thank you for

    subset PosInt of Int is export where * > 0;

I can export the subset from the module.

Can I export any other variable and constants the same way:

     my $pi = 4.13 is export;

-T

Reply via email to