diff options
Diffstat (limited to 'alv')
| -rw-r--r-- | alv/ast.moon | 7 | ||||
| -rw-r--r-- | alv/base/fndef.moon | 4 | ||||
| -rw-r--r-- | alv/builtin.moon | 23 | ||||
| -rw-r--r-- | alv/cell.moon | 11 | ||||
| -rw-r--r-- | alv/stream/value.moon | 5 |
5 files changed, 12 insertions, 38 deletions
diff --git a/alv/ast.moon b/alv/ast.moon index a25d1cd..044e330 100644 --- a/alv/ast.moon +++ b/alv/ast.moon @@ -16,13 +16,6 @@ -- @tparam Scope scope the scope to evaluate in -- @treturn Result the evaluation result - --- quote this AST Node, preserving its identity. - -- - --- Returns a mutable copy of this Node that shares its identity. - -- - -- @function quote - -- @treturn AST - --- create a clone with its own identity. -- -- creates a clone of this Cell with its own identity by prepending a `parent` diff --git a/alv/base/fndef.moon b/alv/base/fndef.moon index b79ad85..f8858d3 100644 --- a/alv/base/fndef.moon +++ b/alv/base/fndef.moon @@ -13,8 +13,8 @@ class FnDef --- create a new instance -- -- @classmethod - -- @tparam {Value,...} params (`AST:quote`d) naming the function parameters - -- @tparam AST body (`AST:quote`d) expression the function evaluates to + -- @tparam {Value,...} params (unevaluated) naming the function parameters + -- @tparam AST body (unevaluated) expression the function evaluates to -- @tparam Scope scope the lexical scope the function was defined in (closure) new: (@params, @body, @scope) => diff --git a/alv/builtin.moon b/alv/builtin.moon index 022c40c..c80e483 100644 --- a/alv/builtin.moon +++ b/alv/builtin.moon @@ -58,7 +58,7 @@ Define the symbols `sym1`, `sym2`, … to resolve to the values of `val-expr1`, children = L\push -> return for i=1,#tail,2 name, val_expr = tail[i], tail[i+1] - name = (name\quote scope)\unwrap 'sym' + name = name\unwrap 'sym' with val_expr\eval scope scope\set name, \make_ref! @@ -117,7 +117,7 @@ current scope." assert #tail > 0, "'import' requires at least one arguments" children = for i, child in ipairs tail - name = child\quote(scope)\unwrap 'sym' + name = child\unwrap 'sym' with COPILOT\require name scope\set name, \make_ref! Result :children @@ -136,7 +136,7 @@ Requires modules `sym1`, `sym2`, … and merges them into the current scope." assert #tail > 0, "'import' requires at least one arguments" children = for i, child in ipairs tail - with COPILOT\require child\quote(scope)\unwrap 'sym' + with COPILOT\require child\unwrap 'sym' scope\use .value\unwrap 'scope' Result :children @@ -150,9 +150,9 @@ Evaluate `expr1`, `expr2`, … in a new Scope and return scope." value: class extends Builtin eval: (scope, tail) => - scope = Scope scope - children = [expr\eval scope for expr in *tail] - Result :children, value: ValueStream.wrap scope + new_scope = Scope scope + children = [expr\eval new_scope for expr in *tail] + Result :children, value: ValueStream.wrap new_scope export_star = ValueStream.meta meta: @@ -175,7 +175,7 @@ Copies the containing scope if no symbols are given." result else for child in *tail - name = child\quote(scope)\unwrap 'sym' + name = child\unwrap 'sym' with result = scope\get name new_scope\set name, result @@ -199,9 +199,8 @@ function is invoked." assert params.__class == Cell, "'fn's first argument has to be an expression" param_symbols = for param in *params.children assert param.type == 'sym', "function parameter declaration has to be a symbol" - param\quote scope + param - body = body\quote scope Result value: with ValueStream.wrap FnDef param_symbols, body, scope .meta = { summary: "(user defined function)" @@ -224,13 +223,11 @@ function is invoked." assert #tail == 3, "'defn' takes exactly three arguments" { name, params, body } = tail - name = name\quote(scope)\unwrap 'sym' + name = name\unwrap 'sym' assert params.__class == Cell, "'defn's second argument has to be an expression" param_symbols = for param in *params.children assert param.type == 'sym', "function parameter declaration has to be a symbol" - param\quote scope - - body = body\quote scope + param value = with ValueStream.wrap FnDef param_symbols, body, scope .meta = diff --git a/alv/cell.moon b/alv/cell.moon index d341dde..e9125d5 100644 --- a/alv/cell.moon +++ b/alv/cell.moon @@ -86,17 +86,6 @@ class Cell Builtin\eval_cell @, scope, head - --- quote this Cell, preserving its identity. - -- - -- Recursively quotes children, but preserves identity (i.e, shares the - -- `Tag`). A quoted Cell may only be 'used' once. If you want to `eval` a - -- `Cell` multiple times, use `clone`. - -- - -- @treturn Cell - quote: => - children = [child\quote scope for child in *@children] - Cell @tag, children, @white - --- create a clone with its own identity. -- -- creates a clone of this Cell with its own identity by prepending a `parent` diff --git a/alv/stream/value.moon b/alv/stream/value.moon index 98720c9..575b995 100644 --- a/alv/stream/value.moon +++ b/alv/stream/value.moon @@ -124,11 +124,6 @@ class ValueStream extends Stream else error "cannot evaluate #{@}" - --- quote this literal constant. - -- - -- @treturn ValueStream self - quote: => @ - --- stringify this literal constant. -- -- Throws an error if `raw` is not set. |
