Can I limit my Perl 6 program to work with a specific implementation?

dd is a normal Rakudo function, but this is related to my question. Is there a way inside the program to check the implementation and help out if it is not correct? Should I do it on my own?

die "Unsupported VM" unless $*VM ~~ m/^ 'moar' /; 

Maybe we need something like Perl 5 Devel :: AssertOS .

I am not at all interested in creating programs specific to the implementation, but I can imagine cases when one implementation has special features and errors that are incompatible with the program. Because, you know, it has been Java for several years (remember MRJ ?).

+5
source share
1 answer

If you want to run your program only on MoarVM, then:

 die "Must run on MoarVM, not $*VM.name()" unless $*VM.name eq 'moar'; 

should be enough.

+6
source

Source: https://habr.com/ru/post/1270038/


All Articles