I was looking in and saw this comment in the indir
implementation:
sub indir(Str() $path, $what, :$test = <r w>) {
my $newCWD := $*CWD.chdir($path,:$test);
$newCWD // $newCWD.throw;
{
my $*CWD = $newCWD; # temp doesn't work in core settings :-(
$what();
}
}
I thought this use of my
was strange, which led to doc issue #1082 niggling about if my
is actually lexical. I would have thought that temp
would be more appropriate for user-level temporary changes to dynamic variables.
But now, I see this comment, but I'm not quite sure what it means. Is temp
broken this deep? Is it not available here? Or is the comment just wrong?
If the comment is right, has this way of dealing with dynamic variables leaked up to the everyday programmer level because that is what some people have to do in the guts (and they got used to that?)
And, how low-level is this level really? It seems like all of Perl 6 should be available here.
Perhaps the comment in the source code would be less misleading if it was:
# temp $*CWD doesn't work in core settings (which we're in)
# my $*CWD = ... is a decent workaround in this case :)
It seems like all of Perl 6 should be available here.
Full Perl 6 must wait until after completion of compilation of the Perl 6 CORE setting. This corresponds to the Rakudo Perl 6 compiler's "core" src tree. This includes the code with the "# temp doesn't work in core settings :-(" comment.
To emphasize @raiph's point: in general, it's unreasonable to expect any particular Perl 6 feature implemented in rakudo to work at any given point in the CORE, because that's how we make the features available.
Developers working on the core have to be aware of this, and take it into account, for example, in ordering how the CORE is built, and which features are available at which point (and further, which features are more performant at a lower level, so the Perl 6 you see in CORE may not be idiomatic for several different reasons.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With