mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
Remove experimental::builtin warnings from most of the builtin.c functions
Removes the experimental status and associated `experimental::builtin` warning from most of the functions in the `builtin::` space. Still remaining experimental are: * is_bool - because stable boolean tracking was only recently introduced and may not have been thoroughly tested yet * created_as_string, created_as_number - similar * export_lexically - because lexical export of subs is equally still quite new and may need more testing
This commit is contained in:
parent
f5bf33e9cc
commit
edd58c2353
54
builtin.c
54
builtin.c
@ -21,6 +21,7 @@ struct BuiltinFuncDescriptor {
|
||||
XSUBADDR_t xsub;
|
||||
OP *(*checker)(pTHX_ OP *, GV *, SV *);
|
||||
IV ckval;
|
||||
bool is_experimental;
|
||||
};
|
||||
|
||||
#define warn_experimental_builtin(name, prefix) S_warn_experimental_builtin(aTHX_ name, prefix)
|
||||
@ -68,7 +69,6 @@ XS(XS_builtin_true);
|
||||
XS(XS_builtin_true)
|
||||
{
|
||||
dXSARGS;
|
||||
warn_experimental_builtin("true", true);
|
||||
if(items)
|
||||
croak_xs_usage(cv, "");
|
||||
XSRETURN_YES;
|
||||
@ -78,7 +78,6 @@ XS(XS_builtin_false);
|
||||
XS(XS_builtin_false)
|
||||
{
|
||||
dXSARGS;
|
||||
warn_experimental_builtin("false", true);
|
||||
if(items)
|
||||
croak_xs_usage(cv, "");
|
||||
XSRETURN_NO;
|
||||
@ -93,8 +92,6 @@ static OP *ck_builtin_const(pTHX_ OP *entersubop, GV *namegv, SV *ckobj)
|
||||
{
|
||||
const struct BuiltinFuncDescriptor *builtin = NUM2PTR(const struct BuiltinFuncDescriptor *, SvUV(ckobj));
|
||||
|
||||
warn_experimental_builtin(builtin->name, false);
|
||||
|
||||
SV *prototype = newSVpvs("");
|
||||
SAVEFREESV(prototype);
|
||||
|
||||
@ -123,13 +120,12 @@ XS(XS_builtin_func1_scalar)
|
||||
dXSARGS;
|
||||
dXSI32;
|
||||
|
||||
warn_experimental_builtin(PL_op_name[ix], true);
|
||||
|
||||
if(items != 1)
|
||||
croak_xs_usage(cv, "arg");
|
||||
|
||||
switch(ix) {
|
||||
case OP_IS_BOOL:
|
||||
warn_experimental_builtin(PL_op_name[ix], true);
|
||||
Perl_pp_is_bool(aTHX);
|
||||
break;
|
||||
|
||||
@ -174,8 +170,6 @@ XS(XS_builtin_trim)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
warn_experimental_builtin("trim", true);
|
||||
|
||||
if (items != 1) {
|
||||
croak_xs_usage(cv, "arg");
|
||||
}
|
||||
@ -342,8 +336,6 @@ XS(XS_builtin_func1_void)
|
||||
dXSARGS;
|
||||
dXSI32;
|
||||
|
||||
warn_experimental_builtin(PL_op_name[ix], true);
|
||||
|
||||
if(items != 1)
|
||||
croak_xs_usage(cv, "arg");
|
||||
|
||||
@ -398,7 +390,8 @@ static OP *ck_builtin_func1(pTHX_ OP *entersubop, GV *namegv, SV *ckobj)
|
||||
{
|
||||
const struct BuiltinFuncDescriptor *builtin = NUM2PTR(const struct BuiltinFuncDescriptor *, SvUV(ckobj));
|
||||
|
||||
warn_experimental_builtin(builtin->name, false);
|
||||
if(builtin->is_experimental)
|
||||
warn_experimental_builtin(builtin->name, false);
|
||||
|
||||
SV *prototype = newSVpvs("$");
|
||||
SAVEFREESV(prototype);
|
||||
@ -470,7 +463,8 @@ static OP *ck_builtin_funcN(pTHX_ OP *entersubop, GV *namegv, SV *ckobj)
|
||||
{
|
||||
const struct BuiltinFuncDescriptor *builtin = NUM2PTR(const struct BuiltinFuncDescriptor *, SvUV(ckobj));
|
||||
|
||||
warn_experimental_builtin(builtin->name, false);
|
||||
if(builtin->is_experimental)
|
||||
warn_experimental_builtin(builtin->name, false);
|
||||
|
||||
SV *prototype = newSVpvs("@");
|
||||
SAVEFREESV(prototype);
|
||||
@ -485,30 +479,30 @@ static const char builtin_not_recognised[] = "'%" SVf "' is not recognised as a
|
||||
|
||||
static const struct BuiltinFuncDescriptor builtins[] = {
|
||||
/* constants */
|
||||
{ "builtin::true", &XS_builtin_true, &ck_builtin_const, BUILTIN_CONST_TRUE },
|
||||
{ "builtin::false", &XS_builtin_false, &ck_builtin_const, BUILTIN_CONST_FALSE },
|
||||
{ "builtin::true", &XS_builtin_true, &ck_builtin_const, BUILTIN_CONST_TRUE, false },
|
||||
{ "builtin::false", &XS_builtin_false, &ck_builtin_const, BUILTIN_CONST_FALSE, false },
|
||||
|
||||
/* unary functions */
|
||||
{ "builtin::is_bool", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_IS_BOOL },
|
||||
{ "builtin::weaken", &XS_builtin_func1_void, &ck_builtin_func1, OP_WEAKEN },
|
||||
{ "builtin::unweaken", &XS_builtin_func1_void, &ck_builtin_func1, OP_UNWEAKEN },
|
||||
{ "builtin::is_weak", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_IS_WEAK },
|
||||
{ "builtin::blessed", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_BLESSED },
|
||||
{ "builtin::refaddr", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_REFADDR },
|
||||
{ "builtin::reftype", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_REFTYPE },
|
||||
{ "builtin::ceil", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_CEIL },
|
||||
{ "builtin::floor", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_FLOOR },
|
||||
{ "builtin::is_tainted", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_IS_TAINTED },
|
||||
{ "builtin::trim", &XS_builtin_trim, &ck_builtin_func1, 0 },
|
||||
{ "builtin::is_bool", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_IS_BOOL, true },
|
||||
{ "builtin::weaken", &XS_builtin_func1_void, &ck_builtin_func1, OP_WEAKEN, false },
|
||||
{ "builtin::unweaken", &XS_builtin_func1_void, &ck_builtin_func1, OP_UNWEAKEN, false },
|
||||
{ "builtin::is_weak", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_IS_WEAK, false },
|
||||
{ "builtin::blessed", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_BLESSED, false },
|
||||
{ "builtin::refaddr", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_REFADDR, false },
|
||||
{ "builtin::reftype", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_REFTYPE, false },
|
||||
{ "builtin::ceil", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_CEIL, false },
|
||||
{ "builtin::floor", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_FLOOR, false },
|
||||
{ "builtin::is_tainted", &XS_builtin_func1_scalar, &ck_builtin_func1, OP_IS_TAINTED, false },
|
||||
{ "builtin::trim", &XS_builtin_trim, &ck_builtin_func1, 0, false },
|
||||
|
||||
{ "builtin::created_as_string", &XS_builtin_created_as_string, &ck_builtin_func1, 0 },
|
||||
{ "builtin::created_as_number", &XS_builtin_created_as_number, &ck_builtin_func1, 0 },
|
||||
{ "builtin::created_as_string", &XS_builtin_created_as_string, &ck_builtin_func1, 0, true },
|
||||
{ "builtin::created_as_number", &XS_builtin_created_as_number, &ck_builtin_func1, 0, true },
|
||||
|
||||
/* list functions */
|
||||
{ "builtin::indexed", &XS_builtin_indexed, &ck_builtin_funcN, 0 },
|
||||
{ "builtin::export_lexically", &XS_builtin_export_lexically, NULL, 0 },
|
||||
{ "builtin::indexed", &XS_builtin_indexed, &ck_builtin_funcN, 0, false },
|
||||
{ "builtin::export_lexically", &XS_builtin_export_lexically, NULL, 0, true },
|
||||
|
||||
{ NULL, NULL, NULL, 0 }
|
||||
{ NULL, NULL, NULL, 0, false }
|
||||
};
|
||||
|
||||
XS(XS_builtin_import);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package builtin 0.008;
|
||||
package builtin 0.009;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@ -40,12 +40,9 @@ can be requested for convenience.
|
||||
Individual named functions can be imported by listing them as import
|
||||
parameters on the C<use> statement for this pragma.
|
||||
|
||||
The overall C<builtin> mechanism, as well as every individual function it
|
||||
provides, are currently B<experimental>.
|
||||
|
||||
B<Warning>: At present, the entire C<builtin> namespace is experimental.
|
||||
Calling functions in it will trigger warnings of the C<experimental::builtin>
|
||||
category.
|
||||
B<Warning>: At present, many of the functions in the C<builtin> namespace are
|
||||
experimental. Calling them will trigger warnings of the
|
||||
C<experimental::builtin> category.
|
||||
|
||||
=head2 Lexical Import
|
||||
|
||||
@ -106,6 +103,8 @@ This gives an equivalent value to expressions like C<!!0> or C<!1>.
|
||||
|
||||
$bool = is_bool($val);
|
||||
|
||||
This function is currently B<experimental>.
|
||||
|
||||
Returns true when given a distinguished boolean value, or false if not. A
|
||||
distinguished boolean value is the result of any boolean-returning builtin
|
||||
function (such as C<true> or C<is_bool> itself), boolean-returning operator
|
||||
@ -167,6 +166,8 @@ C<ARRAY> for array references, or C<HASH> for hash references.
|
||||
|
||||
$bool = created_as_string($val);
|
||||
|
||||
This function is currently B<experimental>.
|
||||
|
||||
Returns a boolean representing if the argument value was originally created as
|
||||
a string. It will return true for any scalar expression whose most recent
|
||||
assignment or modification was of a string-like nature - such as assignment
|
||||
@ -188,6 +189,8 @@ strings. For example
|
||||
|
||||
$bool = created_as_number($val);
|
||||
|
||||
This function is currently B<experimental>.
|
||||
|
||||
Returns a boolean representing if the argument value was originally created as
|
||||
a number. It will return true for any scalar expression whose most recent
|
||||
assignment or modification was of a numerical nature - such as assignment from
|
||||
@ -293,6 +296,8 @@ Returns true when given a tainted variable.
|
||||
|
||||
export_lexically($name1, $ref1, $name2, $ref2, ...)
|
||||
|
||||
This function is currently B<experimental>.
|
||||
|
||||
Exports new lexical names into the scope currently being compiled. Names given
|
||||
by the first of each pair of values will refer to the corresponding item whose
|
||||
reference is given by the second. Types of item that are permitted are
|
||||
|
||||
@ -178,8 +178,8 @@ Using this feature triggers warnings in the category C<experimental::builtin>.
|
||||
|
||||
In Perl 5.36.0, a new namespace, C<builtin>, was created for new core functions
|
||||
that will not be present in every namespace, but will be available for
|
||||
importing. The namespace itself is considered an experiment. Specific
|
||||
functions within it may also be experimental.
|
||||
importing. The namespace itself was considered experimental until Perl 5.39.2.
|
||||
Some specific functions within it remain experimental.
|
||||
|
||||
The ticket for this experiment is
|
||||
L<[perl #19764]|https://github.com/Perl/perl5/issues/19764>.
|
||||
|
||||
@ -27,14 +27,8 @@ $true->();
|
||||
$false->();
|
||||
EXPECT
|
||||
Built-in function 'builtin::is_bool' is experimental at - line 6.
|
||||
Built-in function 'builtin::true' is experimental at - line 7.
|
||||
Built-in function 'builtin::false' is experimental at - line 8.
|
||||
Built-in function 'builtin::is_bool' is experimental at - line 9.
|
||||
Built-in function 'builtin::true' is experimental at - line 10.
|
||||
Built-in function 'builtin::false' is experimental at - line 11.
|
||||
Built-in function 'builtin::is_bool' is experimental at - line 12.
|
||||
Built-in function 'builtin::true' is experimental at - line 13.
|
||||
Built-in function 'builtin::false' is experimental at - line 14.
|
||||
########
|
||||
# builtin.c - weakrefs
|
||||
use strict;
|
||||
@ -62,15 +56,6 @@ $is_weak->($ref);
|
||||
$weaken->($ref);
|
||||
$unweaken->($ref);
|
||||
EXPECT
|
||||
Built-in function 'builtin::is_weak' is experimental at - line 7.
|
||||
Built-in function 'builtin::weaken' is experimental at - line 8.
|
||||
Built-in function 'builtin::unweaken' is experimental at - line 9.
|
||||
Built-in function 'builtin::is_weak' is experimental at - line 10.
|
||||
Built-in function 'builtin::weaken' is experimental at - line 11.
|
||||
Built-in function 'builtin::unweaken' is experimental at - line 12.
|
||||
Built-in function 'builtin::is_weak' is experimental at - line 13.
|
||||
Built-in function 'builtin::weaken' is experimental at - line 14.
|
||||
Built-in function 'builtin::unweaken' is experimental at - line 15.
|
||||
########
|
||||
# builtin.c - blessed refs
|
||||
use strict;
|
||||
@ -98,15 +83,6 @@ $blessed->($ref);
|
||||
$refaddr->($ref);
|
||||
$reftype->($ref);
|
||||
EXPECT
|
||||
Built-in function 'builtin::blessed' is experimental at - line 7.
|
||||
Built-in function 'builtin::refaddr' is experimental at - line 8.
|
||||
Built-in function 'builtin::reftype' is experimental at - line 9.
|
||||
Built-in function 'builtin::blessed' is experimental at - line 10.
|
||||
Built-in function 'builtin::refaddr' is experimental at - line 11.
|
||||
Built-in function 'builtin::reftype' is experimental at - line 12.
|
||||
Built-in function 'builtin::blessed' is experimental at - line 13.
|
||||
Built-in function 'builtin::refaddr' is experimental at - line 14.
|
||||
Built-in function 'builtin::reftype' is experimental at - line 15.
|
||||
########
|
||||
# builtin.c - indexed
|
||||
use strict;
|
||||
@ -116,8 +92,5 @@ my @array = indexed 1..3;
|
||||
my $scalar = indexed 1..3;
|
||||
indexed 1..3;
|
||||
EXPECT
|
||||
Built-in function 'builtin::indexed' is experimental at - line 5.
|
||||
Built-in function 'builtin::indexed' is experimental at - line 6.
|
||||
Built-in function 'builtin::indexed' is experimental at - line 7.
|
||||
Useless use of builtin::indexed in scalar context at - line 6.
|
||||
Useless use of builtin::indexed in void context at - line 7.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user