# New Ticket Created by  "shinobi.cl ." 
# Please include the string:  [perl #132780]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=132780 >


I need the junction to be applied inside the regex, not at time of
parameter binding, so i use the type Mu.


`
> my Regex @rxs = (rx/3/, rx/2/); my @L = (1 .. 23); sub search(Mu $r where
Regex) { grep $r, :v, @L }; say search( any(@rxs) );
(2 3 12 13 20 21 22 23)

> my Regex @rxs = (rx/3/, rx/2/); my @L = (1 .. 23); sub search(Mu $r where
Regex) { grep $r, :v, @L }; say search( all(@rxs) );
(23)

> my Regex @rxs = (rx/3/, rx/2/); my @L = (1 .. 23); sub search(Mu $r where
Regex) { grep $r, :v, @L }; say search( one(@rxs) );
Constraint type check failed in binding to parameter '$r'; expected
anonymous constraint to be met but got Junction (one(rx/3/, rx/2/))
  in sub search at <unknown file> line 1
  in block <unit> at <unknown file> line 1

> my Regex @rxs = (rx/3/, rx/2/); my @L = (1 .. 23); sub search(Mu $r where
Regex) { grep $r, :v, @L }; say search( none(@rxs) );
Died with X::TypeCheck::Binding::Parameter
  in sub search at <unknown file> line 1
  in block <unit> at <unknown file> line 1

>

`

Now, removing Mu, just because :). When used with none, a strange warning
message appears

> my Regex @rxs = (rx/3/, rx/2/); my @L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @L }; say search( any(@rxs) );
(3 13 23)
(2 12 20 21 22 23)
> my Regex @rxs = (rx/3/, rx/2/); my @L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @L }; say search( all(@rxs) );
(3 13 23)
(2 12 20 21 22 23)
> my Regex @rxs = (rx/3/, rx/2/); my @L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @L }; say search( one(@rxs) );
(3 13 23)
(2 12 20 21 22 23)
> my Regex @rxs = (rx/3/, rx/2/); my @L = (1 .. 23); sub search($r where
Regex) { grep $r, :v, @L }; say search( none(@rxs) );
(3 13 23)
(2 12 20 21 22 23)
No such method 'handled' for invocant of type 'Bool'

>

-- 
-shinobi.cl-

Reply via email to