From e197bfd9518ace46f07f619dd3e6d6f17540caa6 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 24 Aug 2021 21:42:55 -0400 Subject: =?UTF-8?q?Refine=20=E2=80=A2ReBQN=20specification=20and=20remove?= =?UTF-8?q?=20system=20values=20other=20than=20=E2=80=A2BQN=20that=20it=20?= =?UTF-8?q?replaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/system.html | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'docs/spec') diff --git a/docs/spec/system.html b/docs/spec/system.html index 64200f27..de33a0d4 100644 --- a/docs/spec/system.html +++ b/docs/spec/system.html @@ -8,7 +8,7 @@

This portion of the spec is still potentially subject to major changes.

The symbol is used to access values other than primitives provided by BQN.

All system values described in the BQN specification are optional: an implementation does not have to include any of them. However, if a system value with one of the names given below is included, then it must have the specified behavior. For namespaces this rule applies to individual fields as well: a namespace may be provided with only some of the fields, but a field with one of the given names must behave as specified.

-

Execution and scope manipulation

+

Execution

@@ -22,31 +22,17 @@ - - - - - - - - - - - - - - + + - - + +
Evaluate the argument string in an isolated scope
•EvalEvaluate the argument string in the current scope
•ScopedEvalEvaluate the argument string in a child scope
•MakeREPLCreate an evaluator that keeps variables across runs
•UsingImport all values from the argument namespace•ReBQNCreate a BQN-like evaluation function with options 𝕩
•NewBQNCreate a BQN-like evaluation function with options 𝕩•primitivesList of primitives as glyph-value pairs
-

The left argument to any evaluator (•BQN, •Eval, •ScopedEval, result of •MakeREPL), if given, is a list of up to three elements, giving a prefix of •state (see next section) during evaluations of that function. Thus "","xyz"•BQN"•name" returns "xyz".

-

The effect of •Eval should be the same as if its argument were written as source code in the scope where •Eval appears. It can define variables, and modify those in the current scope or a parent.

-

•ScopedEval creates as new scope for evaluation as it is loaded. Other than its syntactic role, it is effectively equivalent to {•Eval}. Parent scopes are visible from the created scope; to make a scope without this property use •BQN"•Eval" or •BQN"•ScopedEval".

-

•NewBQN accepts a namespace 𝕩. The following options are specified if supported:

+

The left argument to •BQN or the result of •ReBQN, if given, is a list of up to three elements, giving a prefix of •state (see next section) during evaluations of that function. Thus "","xyz"•BQN"•name" returns "xyz".

+

•ReBQN accepts a namespace 𝕩. The following options are specified if supported:

@@ -60,20 +46,20 @@ - - + + - - + + - - + +
"none", "strict", "loose"
scope"none", "read", "modify"primitivesList of glyph-value pairs; default •primitives
primitivesList of glyph-value pairs; default ⟨⟩system"all", "none", "safe" or list of names
retain"all", "unique", "none"scope"none", "read", "modify" or list of name-setting pairs
-

The option repl indicates how variables are retained across calls: with "none" they are not saved; with "strict", they are saved and can't be redefined; and with "loose" they may be redefined. scope indicates allowed interaction with the scope in which •NewBQN is called (not loaded): with "read" variables may be read and with "modify" they may be read or modified. primitives indicates primitives to be added in this copy of BQN. Each primitive uses the glyph and value given. The value must have an operation type and its type determines the primitive's role. retain indicates which primitives from the current running BQN should be kept. With "all", an error is given if primitives redefines an existing primitive, but with "unique" primitives may be redefined.

+

The option repl indicates how variables are retained across calls: with "none" they are not saved; with "strict", they are saved and can't be redefined; and with "loose" they may be redefined. Each element in primitives gives the glyph and value for a primitive to be made available. The value must have an operation type and its type determines the primitive's role. system in general gives the list of system values to be made available, with shorthand values to indicate all currently-available ones, none of them, or only a subset that cannot be used to interact with anything outside of the execution context. scope indicates allowed interaction with the scope in which •ReBQN is called (not loaded): with "read" variables may be read and with "modify" they may be read or modified.

Scripts

-- cgit v1.2.3