11

Running the following simple code, checking the behaviour of sigilless variables, produces a strange error:

use v6.d;  # Rakudo Star 2020.05.01 (Windows)

sub test ($p) {
    say $p;
}

my \v1 = 1;

say v1;   # v1 (ERROR)
test(v1); # v1 (ERROR)

my \v = 1;

say v;   # 1 (Correct)
test(v); # 1 (Correct)

my \vv1 = 1;

say vv1;   # 1 (Correct)
test(vv1); # 1 (Correct)

my \s1 = 1;

say s1;   # 1 (Correct)
test(s1); # 1 (Correct)

Why is that?

jjmerelo
  • 22,578
  • 8
  • 40
  • 86
jakar
  • 1,701
  • 5
  • 14

1 Answers1

16

Literals that start with v and are followed by a number (and dots and then other numbers) are considered versions. That means that you can't use anything starting with v and followed by numbers as sigilless identifier.

say (v1.2.3).parts; # OUTPUT: «(1 2 3)␤» 

That's probably underdocumented, though...

jjmerelo
  • 22,578
  • 8
  • 40
  • 86