GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — repl: convert to ES2015 class by avivkeller · Pull Request #54838 · nodejs/node

Conversation

@avivkeller

@avivkeller avivkeller commented Sep 7, 2024

Copy link
Copy Markdown
Member

This PR modifies the REPL to use an ES5 class.

It will (hopefully) be one of many in series to refactor the REPL's code, as IMO it is currently hard to read as is. My plan is to first convert the REPL to ECMAScript classes, and then move away from using the the domain module. IMO keeping the internal codebase up-to-date with deprecations and additions is a great way to maintain longevity.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

meyfa and bricss reacted with heart emoji bricss reacted with rocket emoji
All reactions
  • ❤️ 2 reactions
  • 🚀 1 reaction
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. labels Sep 7, 2024
@avivkeller

avivkeller commented Sep 7, 2024

Copy link
Copy Markdown
Member Author

Right now, despite this change, most of the logic for the REPL remains in the constructor. I plan to move those into class methods (but not all at once - as that broke things).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@avivkeller

avivkeller commented Sep 7, 2024

Copy link
Copy Markdown
Member Author

CC @nodejs/repl

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Sep 7, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 94.02439% with 49 lines in your changes missing coverage. Please review.

Project coverage is 87.62%. Comparing base (5a3c605) to head (67a09cf).
Report is 41 commits behind head on main.

Files with missing lines Patch % Lines
lib/repl.js 94.02% 47 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #54838    +/-   ##
========================================
  Coverage   87.61%   87.62%            
========================================
  Files         650      651     +1     
  Lines      182945   183326   +381     
  Branches    35394    35445    +51     
========================================
+ Hits       160282   160632   +350     
- Misses      15918    15953    +35     
+ Partials     6745     6741     -4     
Files with missing lines Coverage Δ
lib/repl.js 94.06% <94.02%> (-0.06%) ⬇️

... and 33 files with indirect coverage changes

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell requested changes Sep 7, 2024
View reviewed changes

@jasnell jasnell left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against this change but I think we need to take it through a deprecation cycle first given the breaking change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

avivkeller reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread lib/repl.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@avivkeller
avivkeller marked this pull request as draft September 7, 2024 22:25
@aduh95

aduh95 commented Sep 8, 2024

Copy link
Copy Markdown
Contributor

Typo in the commit title s/ES5/ES2015/: "ECMAScript [5] does not use classes such as those in C++, Smalltalk, or Java." (source: https://262.ecma-international.org/5.1/#sec-4.2.1). The class keyword is listed as "Future Reserved Words" in ES5, see https://262.ecma-international.org/5.1/#sec-7.6.1.2

avivkeller reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@avivkeller
repl: convert to ES2015 class
0e79995
@avivkeller avivkeller changed the title repl: convert to ES5 class repl: convert to ES2015 class Sep 8, 2024
@avivkeller avivkeller added the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 8, 2024
@avivkeller

avivkeller commented Sep 8, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

semver-major, as this is a breaking change. See #54842 for the deprecation, which should land in a release line before this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Sep 9, 2024
View reviewed changes
@marco-ippolito

marco-ippolito commented Sep 9, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

semver-major, as this is a breaking change. See #54842 for the deprecation, which should land in a release line before this.

doc deprecation needs to be followed by a runtime deprecation (emit a warning) which is semver major. The runtime deprecation needs to land before refactoring and removing the constructor without new which is a EOL deprecation.

avivkeller reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@atlowChemi

atlowChemi commented Sep 14, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@redyetidev We might want to consider landing this (possibly temporarily) with a solution similar to what some of the test-runner reporters implemented to solve this semver-major issue:

node/lib/test/reporters.js

Lines 34 to 42 in a65105e

spec: {
__proto__: null,
configurable: true,
enumerable: true,
value: function value() {
spec ??= require('internal/test_runner/reporter/spec');
return ReflectConstruct(spec, arguments);
},
},

node/lib/test/reporters.js

Lines 52 to 60 in a65105e

lcov: {
__proto__: null,
configurable: true,
enumerable: true,
value: function value() {
lcov ??= require('internal/test_runner/reporter/lcov');
return ReflectConstruct(lcov, arguments);
},
},

This would potentially allow landing this PR without needing to wait for the entire deprecation cycle to complete, and handle the deprecation separately

avivkeller reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@avivkeller avivkeller added the blocked PRs that are blocked by other issues or PRs. label Sep 14, 2024
@avivkeller

avivkeller commented Sep 14, 2024

Copy link
Copy Markdown
Member Author

The issue with that is:

const reporters = require("node:test/reporters");
(new reporters.spec()) instanceof reporters.spec // false

Sidenote: This is blocked by #54869

atlowChemi reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@avivkeller avivkeller closed this Sep 23, 2024
@avivkeller

avivkeller commented Sep 23, 2024

Copy link
Copy Markdown
Member Author

Closing until the runtime deprecation is done (which won't be for a while)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Jul 27, 2026
test(repl): expand Node 26.5 parity coverage PerryTS/perry#6869
Merged
11 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell requested changes
@addaleax addaleax addaleax approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

blocked PRs that are blocked by other issues or PRs. needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@avivkeller @aduh95 @marco-ippolito @atlowChemi @jasnell @addaleax @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.