Specify particular Rakudo version in Raku module

130 Views Asked by At

Today, I learned in IRC chat that

my @a = [9, 4, 3, 2, 7];
say @a.sort(:k) # (3 2 1 4 0)

is available since Rakudo 2023.08. I want my module to use this feature. Is there inbuilt mechanism to specify this in module, may be by modifying META6.json ?

Like if the Rakudo is earlier than 2023.08, fail the installation of module.

What I know is we can specify 6.c, 6.d, 6.e e.g:

"raku": "6.d"

in META6.json file. This however does not address the issue.

1

There are 1 best solutions below

7
librasteve On

Sadly current Raku does not have an inbuilt mechanism to control the VM version such as 2023.08 (eg. via META6.json) below the level of major raku release such as 6.d.

I suggest (and would support) this as a new feature request. In the meantime, here is a rough and ready workaround:

die "must be raku v2023.08 or greater" 
unless $*VM.version ~~ v2023.08+;

^^ put this in your test if you want installation to fail