You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.
But whereas in Perl 5 it makes sense, I fail to see the purpose of it in Perl 6. If the programmer wants to clear a container (or set it to its default value), they can just assign Nil or Empty themselves:
$x = Nil;
@a = Empty;
%h = Empty;
If it's for the convenience of having a function that does just this, then shouldn't it have a more appropriate name? "reset"? "clear"? "set-to-default"? "undefine" besides being a longer name than "undef", doesn't do what its name says, it doesn't undefine variables in the ".defined method" meaning:
my $x is default(42);
my @a;
my %h;
undefine $x;
undefine @a;
undefine %h;
say $x.defined; #=> True
say @a.defined; #=> True
say %h.defined; #=> True
It feels strange in this situation:
> my $a is default(42); $a = 10; dd $a; undefine $a; dd $a
Int $a = 10
Int $a = 42
> my $a is default(42); $a = []; dd $a; undefine $a; dd $a
Array $a = $[]
Slip $a = Empty
So, is there any plans for what to do with the undefine function? Or this should stay as it is?
The text was updated successfully, but these errors were encountered:
This feels like a straggler from the days of undef being a thing. I suspect it has minimal usage in the module ecosystem, but we should probably check.
I'm inclined towards deprecating this in 6.d; it's a sub, so it's easy to do that already by just sticking an implementation of it CORE.d.setting and marking it is DEPCREATED so we only warn when using the 6.d language version..
The undefine routine is defined in file
src/core/operators.pmas:It seems to be reminiscent from Perl 5, where you can write like this:
But whereas in Perl 5 it makes sense, I fail to see the purpose of it in Perl 6. If the programmer wants to clear a container (or set it to its default value), they can just assign Nil or Empty themselves:
If it's for the convenience of having a function that does just this, then shouldn't it have a more appropriate name? "reset"? "clear"? "set-to-default"? "undefine" besides being a longer name than "undef", doesn't do what its name says, it doesn't undefine variables in the ".defined method" meaning:
It feels strange in this situation:
So, is there any plans for what to do with the undefine function? Or this should stay as it is?
The text was updated successfully, but these errors were encountered: