Repository navigation
Conversation
`:type <expr>` checks the expression as the next entry, without running
it, and prints the type of its value: its type variables as letters in
the order they appear and the bounds its scheme asks of them
(`:type list.sort` is `Fn(List(a)) -> List(a) where a: Compare`). The
type is the scheme of the function that holds the entry's statements
(Session::cell_value_scheme), so it is the checker's own, not a second
inference. The entry is never compiled or committed: no later entry
sees it, and it is forgotten when the next one is added. Its errors
show as any entry's; an expression may go on over lines as any entry
may. Declarations are refused ("takes an expression, not a
declaration").
`:doc <name>` reads the builtin registry: a function's or constant's
signature (as the reference pages write it) and its summary line; for a
module, the signatures of its functions in name order; for a function
of a cargo feature that is not built, also what it needs. It needs no
import.
Both are listed in `:help` (its columns widened to fit them) and
offered by <Tab>; getting-started describes them.
Tests: goldens cli/repl/repl_type_command__* and repl_doc_command__*
(fail on the base: "unknown REPL command"), a unit test that a typed
entry binds nothing; the three help goldens re-blessed for the two new
lines and the wider columns.
rendro
added this pull request to stack #150
October 24, 2026 02:47
From the verifier's report on the REPL commands:
- `:doc` covers every builtin name now. A type (`Option`, `json.Value`,
`task.Handle`) and a trait (`Display`, `json.Encode`) show their
declaration on one line as the language card writes it, then the
first sentence of their section of the reference pages (of a prelude
trait, of its documentation). A variant (`Some`, `channel.Message`,
`time.Weekday.Monday`) shows its enum's declaration and the first
sentence of its own section, or else its row of the enum's table
(`io.NotFound`: "file or directory missing"). A type of the language
(`Int`, `List`) shows `type List(a) -- builtin` and the first sentence
of its module's page. A module lists its types, traits and opaque
types before its functions, as the card does. An unknown name: "no
builtin named 'x'". (`:help` names `Option` among the examples.)
- `:type` writes the bounds of one variable joined by `+`, as the
reference pages do: `where a: Equal + Display`.
- The example in ":type needs an expression" and in getting-started
works in a new session, without an import: `:type [1, 2]`, `:type Some`.
- The prelude's functions say one thing everywhere. Their summaries are
globals.md's ("Print a value with trailing newline", ...), and
globals.md's table rows and signature blocks for them are now written
from the registry by render_page, like every module page's, and
checked by the same test; a table that lists some of them must list
all. panic's signature is the checker's, `-> Never` (`-> b` would no
longer end an `else` that must diverge); globals.md says what Never
is and that it is not written.
The declarations come from new helpers in registry/docs.rs
(module_lines, prelude_lines, type_line, trait_line, variant_enum, and
the summaries), which the language card will share.
Tests: goldens cli/repl/repl_doc_command__a_type_a_trait_or_a_variant
(33 names) and __a_module_lists_its_types_and_traits; changed outputs:
repl_doc_command__a_builtin_s_signature_and_summary (println's summary,
uuid's UuidError line), __errors (the new names it tries and the
message), repl_type_command__errors (the example), __the_type_of_an_expression
(+ test.assert_eq's two bounds); unit test
the_prelude_s_functions_are_written_from_the_rows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Lane D, PR 1 of 4 (wave 2).
:type <expr>checks the expression as the next entry, without compiling or committing it, and prints its type with where-bounds, e.g.:type list.sort->Fn(List(a)) -> List(a) where a: Compare.:doc <name>prints a builtin's signature in the reference-page form and its summary. A module lists its functions; a function of an unbuilt feature says which cargo feature it needs.:help. getting-started.md documents them.Tests: new goldens under cli/repl (repl_type_command__, repl_doc_command__) fail on the base with "unknown REPL command"; unit test repl::tests::a_typed_entry_is_not_run_and_binds_nothing. Three help goldens change: two new lines and a column two spaces wider.
New texts await the owner's approval before merge.