Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for all repl types #52876

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ _displaysize(io::IO) = displaysize(io)::Tuple{Int,Int}
include("Terminals.jl")
using .Terminals

"""
AbstractREPL

The abstract base type for all REPL implementations in Julia. `AbstractREPL` serves as a blueprint for defining various REPL interfaces.
Copy link
Member

Choose a reason for hiding this comment

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

No need to explain what "abstract base type" means — this is standard terminology.

Suggested change
The abstract base type for all REPL implementations in Julia. `AbstractREPL` serves as a blueprint for defining various REPL interfaces.
The abstract base type for all REPL implementations in Julia.


Implementations of `AbstractREPL` must define specific methods that dictate how the REPL reads input, evaluates it, and prints output.
Copy link
Member

Choose a reason for hiding this comment

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

Similar to the above, I don't think this is particularly useful either. In general abstract types should either document the interface (which is not really stable here, so probably doesn't make sense) or tell you which concrete type you should choose instead, so some of the feature comparison discussion below might help.

There could also potentially be discussions of the overall REPL architecture (frontend/backend split) or other topics that span across implementations here.

"""
abstract type AbstractREPL end

include("options.jl")
Expand Down Expand Up @@ -399,7 +406,16 @@ function run_repl(repl::AbstractREPL, @nospecialize(consumer = x -> nothing); ba
end

## BasicREPL ##
"""
BasicREPL

A mutable struct representing a basic implementation of the Julia REPL (Read-Eval-Print Loop), primarily designed for straightforward and fundamental interactive command execution.
RichieWilynnton marked this conversation as resolved.
Show resolved Hide resolved

# Arguments
RichieWilynnton marked this conversation as resolved.
Show resolved Hide resolved
- `terminal::TextTerminal`: Handles input/output operations.
- `waserror::Bool`: A flag to track the occurrence of errors (initially set to `false`).
- `frontend_task::Task`: Manages front-end activities like user interactions.
"""
mutable struct BasicREPL <: AbstractREPL
terminal::TextTerminal
waserror::Bool
Expand Down Expand Up @@ -458,7 +474,15 @@ function run_frontend(repl::BasicREPL, backend::REPLBackendRef)
end

## LineEditREPL ##
"""
LineEditREPL
An advanced implementation of the Julia REPL (Read-Eval-Print Loop), designed to enhance user interaction with robust line-editing capabilities.

This REPL type integrates features such as cursor movement, text editing, command history navigation, auto-completion, and more interactive elements that facilitate a more efficient and user-friendly command-line experience.
stevengj marked this conversation as resolved.
Show resolved Hide resolved
Unlike `BasicREPL`, which provides fundamental REPL functionalities, `LineEditREPL` focuses on a richer and more interactive command-line interface.
It is particularly suited for environments where extended command-line usability is essential, offering a more sophisticated and feature-rich interface for users who perform complex and frequent interactions with the Julia REPL.
This REPL type is typically the default in standard Julia installations, reflecting its comprehensive functionality that caters to a wide range of user needs.
Copy link
Member

Choose a reason for hiding this comment

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

Should link to the manual section. https://docs.julialang.org/en/v1/stdlib/REPL/

"""
mutable struct LineEditREPL <: AbstractREPL
t::TextTerminal
hascolor::Bool
Expand Down Expand Up @@ -1344,7 +1368,12 @@ function run_frontend(repl::LineEditREPL, backend::REPLBackendRef)
end

## StreamREPL ##
"""
StreamREPL
A specialized implementation of Julia's REPL (Read-Eval-Print Loop) designed to interface with generic IO streams.
RichieWilynnton marked this conversation as resolved.
Show resolved Hide resolved

This flexibility makes it suitable for various input and output sources beyond the standard console, such as files, network sockets, or other custom IO types.
"""
mutable struct StreamREPL <: AbstractREPL
stream::IO
prompt_color::String
Expand Down
4 changes: 1 addition & 3 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,5 @@ let io = IOBuffer()
end

@testset "Docstrings" begin
undoc = Docs.undocumented_names(REPL)
@test_broken isempty(undoc)
@test undoc == [:AbstractREPL, :BasicREPL, :LineEditREPL, :StreamREPL]
@test isempty(Docs.undocumented_names(REPL))
end