Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the use of "is dynamic" ? Maybe we should deprecate it? #2768

lizmat opened this issue Mar 16, 2019 · 1 comment


None yet
2 participants
Copy link

commented Mar 16, 2019

There seems to be little point in externalizing the is dynamic trait. It currently only makes sense if you also add the * as a twigil, but then you don't have to as the * twigil makes already makes it dynamic. Even adding no strict doesn't make it work, as that just silently creates a lexical that masks the dynamic.

$ perl6 -e 'sub a() { dd $*a }; my $*a = 42; a'
Int $*a = 42

$ perl6 -e 'sub a() { dd $*a }; my $a is dynamic = 42; a' => => "\$*a"), backtrace =>

$ perl6 -e 'sub a() { dd $*a }; my $a is dynamic = 42; a'
===SORRY!=== Error while compiling -e
Variable '$a' is not declared
at -e:1
------> sub a() { dd ⏏$a }; my $a is dynamic = 42; a

$ perl6 -e 'sub a() { no strict; dd $a }; my $a is dynamic = 42; a'
Any $a = Any

This comment has been minimized.

Copy link
Contributor Author

commented Mar 17, 2019

The only example (lifted from documentation) that does work. But OTOH, we want to discourage the use of CALLER::, so maybe that's another reason for de-emphasizing is dynamic in favour of just using the twigil * syntax?

$ perl6 -e 'sub a() { dd $CALLER::a }; my $a is dynamic = 42; a'
Int $a = 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.