Skip to content

repl: useGlobal docs and code mismatch #5659

Description

@lance

The API documentation for REPL says,

"useGlobal - if set to true, then the repl will use the global object, instead of running scripts in a separate context. Defaults to false."

This is only true if a REPL is created programmatically. The REPL that is created by simply typing node on the command line defaults useGlobal to true.

This is because the internal createRepl function, used by node.js here, defaults this value to true. https://github.com/nodejs/node/blob/master/lib/internal/repl.js#L25

This can be verified by simply firing up a node REPL and typing .clear. You should see on the REPL command line, this text, "Clearing context....", but you don't.

  • Version: 4.2.4
  • Platform: Darwin Cerebus.local 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64
  • Subsystem: repl

Activity

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

    docIssues and PRs related to Node.js documentation.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions