Skip to content

make all experimental warning messages consistent #30803

Closed
@pd4d10

Description

@pd4d10
Contributor

Some experimental warning messages' contents are not consistent, for example:

(node:70168) ExperimentalWarning: The ESM module loader is experimental.
(node:70372) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time

Shall we make them consistent? If so I'm willing to submit a PR to solve this.

There are two general methods to emit experimental warnings. I think we can make use of them.

JavaScript version

node/lib/internal/util.js

Lines 170 to 176 in 1549c8e

function emitExperimentalWarning(feature) {
if (experimentalWarnings.has(feature)) return;
const msg = `${feature} is an experimental feature. This feature could ` +
'change at any time';
experimentalWarnings.add(feature);
process.emitWarning(msg, 'ExperimentalWarning');
}

C++ version (introduced in #30617)

Maybe<bool> ProcessEmitExperimentalWarning(Environment* env,
const char* warning) {
if (experimental_warnings.find(warning) != experimental_warnings.end())
return Nothing<bool>();
experimental_warnings.insert(warning);
std::string message(warning);
message.append(
" is an experimental feature. This feature could change at any time");
return ProcessEmitWarningGeneric(env, message.c_str(), "ExperimentalWarning");
}

Activity

changed the title [-]make all experimental warning messages consistent[/-] [+]module: make all experimental warning messages consistent[/+] on Dec 5, 2019
pd4d10

pd4d10 commented on Dec 5, 2019

@pd4d10
ContributorAuthor
guybedford

guybedford commented on Dec 5, 2019

@guybedford
Contributor

We've had the The ESM Loader is experimental message for long enough that I think this one is fine to leave as-is until we remove it.

If there are other inconsistencies though we should change them.

pd4d10

pd4d10 commented on Dec 5, 2019

@pd4d10
ContributorAuthor

OK, get it. Found these flags. Seems not related to module.

(node:70168) ExperimentalWarning: Policies are experimental. # --experimental-policy
(node:70168) ExperimentalWarning: The --frozen-intrinsics flag is experimental # --frozen-intrinsics
changed the title [-]module: make all experimental warning messages consistent[/-] [+]make all experimental warning messages consistent[/+] on Dec 5, 2019
guybedford

guybedford commented on Dec 5, 2019

@guybedford
Contributor

Those both seem worth doing to me. The added benefit is ensuring that the code examples follow the correct patterns for future reference.

guybedford

guybedford commented on Dec 5, 2019

@guybedford
Contributor

(//cc @bmeck)

added
experimentalIssues and PRs related to experimental features.
on Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    experimentalIssues and PRs related to experimental features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @guybedford@targos@pd4d10

      Issue actions

        make all experimental warning messages consistent · Issue #30803 · nodejs/node