From 33389e3f57e08aefa9565d1a40c88b41550c50e2 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 15 May 2021 15:32:14 -0400 Subject: =?UTF-8?q?Add=20=E2=80=A2Repr=20to=20system=20value=20spec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/system.html | 5 +++++ spec/system.md | 3 +++ 2 files changed, 8 insertions(+) diff --git a/docs/spec/system.html b/docs/spec/system.html index eeb02814..84ef65c3 100644 --- a/docs/spec/system.html +++ b/docs/spec/system.html @@ -274,12 +274,17 @@ Print argument value +•Repr +String representation of 𝕩, if possible + + •Fmt Format value for printing

•Out prints a string to stdout, with a trailing newline. •Show displays a BQN value to the programmer (the representation is not specified, and does not need to be plain text). •Fmt returns a string (not a character table: lines are separated by linefeeds) indicating how 𝕩 would be printed by the interactive environment. Both •Show and •Fmt may take a left argument configuring how the value should be formatted.

+

•Repr attempts to return a string so that •BQN •Repr 𝕩 matches 𝕩. If 𝕩 contains any mutable values (operations or namespaces), this is not possible. However, if such a values is stateless, in the sense that they don't access variables outside of their own scopes, it is permissible for •Repr to return source code that would create a value with identical behavior.

Operation properties

diff --git a/spec/system.md b/spec/system.md index dd17f471..0fed759c 100644 --- a/spec/system.md +++ b/spec/system.md @@ -133,10 +133,13 @@ The following short names can also be provided for file access. They can be prov |---------|---------------------- | `•Out` | Print argument string | `•Show` | Print argument value +| `•Repr` | String representation of `𝕩`, if possible | `•Fmt` | Format value for printing `•Out` prints a string to stdout, with a trailing newline. `•Show` displays a BQN value to the programmer (the representation is not specified, and does not need to be plain text). `•Fmt` returns a string (not a character table: lines are separated by linefeeds) indicating how `𝕩` would be printed by the interactive environment. Both `•Show` and `•Fmt` may take a left argument configuring how the value should be formatted. +`•Repr` attempts to return a string so that `•BQN •Repr 𝕩` matches `𝕩`. If `𝕩` contains any mutable values (operations or namespaces), this is not possible. However, if such a values is stateless, in the sense that they don't access variables outside of their own scopes, it is permissible for `•Repr` to return source code that would create a value with identical behavior. + ## Operation properties | Name | Summary -- cgit v1.2.3