rakudo
rakudo copied to clipboard
Regex loses identity when used in whatever code in module
The Problem
Given the following Foo.rakumod
my Regex $regex = /ab/;
subset Foo where * === $regex;
sub foo is export {
say $regex ~~ Foo;
}
and the following script foo.raku:
use Foo;
foo();
$regex will lose its identity, and therefor not work as expected.
Expected Behavior
It should print True
Actual Behavior
It prints False
It wll print True if either:
- The code is put in
foo.rakuitself - If
$regexis madeconstant - If the
WhateverCodeis converted into a block{ $^value == $regex }.
It is not affected by no precompilation;, and $regex.WHICH will return the same value inside and outside sub foo.
Environment
Welcome to Rakudo(tm) v2020.12.
Implementing the Raku(tm) programming language v6.d.
Built on MoarVM version 2020.12.