From b48ea68a83d01903554c7696c77eedaaf1035680 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 12 Jun 2022 00:38:20 -0400 Subject: De-sigil-ification: suffix : [Part 3] --- stdlib/source/documentation/lux.lux | 31 +- .../documentation/lux/control/concatenative.lux | 4 +- .../documentation/lux/control/parser/analysis.lux | 2 +- .../documentation/lux/control/parser/binary.lux | 6 +- .../documentation/lux/control/parser/code.lux | 6 +- .../documentation/lux/control/parser/json.lux | 4 +- .../documentation/lux/control/parser/synthesis.lux | 2 +- .../documentation/lux/control/parser/text.lux | 12 +- .../documentation/lux/control/parser/tree.lux | 2 +- .../documentation/lux/control/parser/type.lux | 4 +- .../lux/data/collection/dictionary/ordered.lux | 2 +- .../documentation/lux/data/collection/list.lux | 2 +- stdlib/source/documentation/lux/data/color.lux | 2 +- .../source/documentation/lux/data/color/named.lux | 2 +- .../source/documentation/lux/data/format/json.lux | 2 +- .../documentation/lux/data/text/encoding.lux | 2 +- .../documentation/lux/data/text/unicode/block.lux | 2 +- stdlib/source/documentation/lux/ffi.jvm.lux | 6 +- stdlib/source/documentation/lux/ffi.old.lux | 2 +- stdlib/source/documentation/lux/math/number.lux | 2 +- .../source/documentation/lux/math/number/frac.lux | 6 +- .../source/documentation/lux/math/number/i64.lux | 4 +- .../source/documentation/lux/math/number/int.lux | 4 +- .../source/documentation/lux/math/number/nat.lux | 4 +- .../source/documentation/lux/math/number/rev.lux | 4 +- stdlib/source/documentation/lux/static.lux | 4 +- stdlib/source/documentation/lux/time.lux | 2 +- stdlib/source/documentation/lux/type.lux | 8 +- stdlib/source/documentation/lux/type/primitive.lux | 2 +- stdlib/source/documentation/lux/type/resource.lux | 4 +- stdlib/source/documentation/lux/type/unit.lux | 4 +- .../documentation/lux/world/net/http/client.lux | 2 +- .../documentation/lux/world/net/http/status.lux | 2 +- .../lux/world/output/video/resolution.lux | 2 +- stdlib/source/library/lux.lux | 66 +- stdlib/source/library/lux/abstract/interval.lux | 8 +- stdlib/source/library/lux/abstract/predicate.lux | 4 +- .../source/library/lux/control/concatenative.lux | 4 +- .../library/lux/control/concurrency/async.lux | 4 +- .../library/lux/control/concurrency/semaphore.lux | 2 +- .../library/lux/control/function/contract.lux | 2 +- stdlib/source/library/lux/control/io.lux | 18 +- .../source/library/lux/control/parser/analysis.lux | 2 +- .../source/library/lux/control/parser/binary.lux | 40 +- stdlib/source/library/lux/control/parser/code.lux | 4 +- stdlib/source/library/lux/control/parser/json.lux | 4 +- .../library/lux/control/parser/synthesis.lux | 2 +- stdlib/source/library/lux/control/parser/text.lux | 18 +- stdlib/source/library/lux/control/parser/tree.lux | 2 +- stdlib/source/library/lux/control/parser/type.lux | 13 +- stdlib/source/library/lux/control/remember.lux | 2 +- .../source/library/lux/control/security/policy.lux | 2 +- stdlib/source/library/lux/data/binary.lux | 4 +- stdlib/source/library/lux/data/bit.lux | 4 +- .../source/library/lux/data/collection/array.lux | 2 +- stdlib/source/library/lux/data/collection/bits.lux | 4 +- .../library/lux/data/collection/dictionary.lux | 2 +- .../lux/data/collection/dictionary/ordered.lux | 10 +- .../lux/data/collection/dictionary/plist.lux | 2 +- stdlib/source/library/lux/data/collection/list.lux | 8 +- .../library/lux/data/collection/sequence.lux | 4 +- .../library/lux/data/collection/set/multi.lux | 2 +- .../library/lux/data/collection/set/ordered.lux | 2 +- .../source/library/lux/data/collection/stream.lux | 6 +- .../library/lux/data/collection/tree/finger.lux | 2 +- .../library/lux/data/collection/tree/zipper.lux | 6 +- stdlib/source/library/lux/data/color.lux | 8 +- stdlib/source/library/lux/data/color/named.lux | 2 +- stdlib/source/library/lux/data/format/binary.lux | 23 +- stdlib/source/library/lux/data/format/css.lux | 15 +- .../library/lux/data/format/css/property.lux | 6 +- .../source/library/lux/data/format/css/query.lux | 8 +- .../library/lux/data/format/css/selector.lux | 18 +- .../source/library/lux/data/format/css/value.lux | 72 +- stdlib/source/library/lux/data/format/html.lux | 34 +- stdlib/source/library/lux/data/format/json.lux | 18 +- stdlib/source/library/lux/data/format/markdown.lux | 8 +- stdlib/source/library/lux/data/format/tar.lux | 10 +- stdlib/source/library/lux/data/product.lux | 2 +- stdlib/source/library/lux/data/sum.lux | 4 +- stdlib/source/library/lux/data/text.lux | 4 +- stdlib/source/library/lux/data/text/encoding.lux | 2 +- stdlib/source/library/lux/data/text/escape.lux | 12 +- stdlib/source/library/lux/data/text/format.lux | 6 +- .../source/library/lux/data/text/unicode/block.lux | 4 +- .../source/library/lux/data/text/unicode/set.lux | 2 +- stdlib/source/library/lux/debug.lux | 18 +- stdlib/source/library/lux/documentation.lux | 23 +- stdlib/source/library/lux/extension.lux | 2 +- stdlib/source/library/lux/ffi.jvm.lux | 84 +-- stdlib/source/library/lux/ffi.lux | 109 +-- stdlib/source/library/lux/ffi.old.lux | 53 +- stdlib/source/library/lux/ffi.php.lux | 4 +- stdlib/source/library/lux/ffi.scm.lux | 4 +- stdlib/source/library/lux/ffi/export.rb.lux | 2 +- stdlib/source/library/lux/ffi/node_js.js.lux | 2 +- stdlib/source/library/lux/locale/language.lux | 8 +- stdlib/source/library/lux/locale/territory.lux | 6 +- stdlib/source/library/lux/macro.lux | 2 +- stdlib/source/library/lux/macro/code.lux | 14 +- stdlib/source/library/lux/macro/local.lux | 2 +- stdlib/source/library/lux/macro/pattern.lux | 16 +- stdlib/source/library/lux/macro/syntax.lux | 5 +- stdlib/source/library/lux/macro/template.lux | 4 +- stdlib/source/library/lux/math.lux | 14 +- .../source/library/lux/math/logic/continuous.lux | 2 +- stdlib/source/library/lux/math/logic/fuzzy.lux | 13 +- stdlib/source/library/lux/math/modular.lux | 8 +- stdlib/source/library/lux/math/number.lux | 2 +- stdlib/source/library/lux/math/number/complex.lux | 6 +- stdlib/source/library/lux/math/number/frac.lux | 70 +- stdlib/source/library/lux/math/number/i64.lux | 8 +- stdlib/source/library/lux/math/number/int.lux | 12 +- stdlib/source/library/lux/math/number/nat.lux | 12 +- stdlib/source/library/lux/math/number/ratio.lux | 2 +- stdlib/source/library/lux/math/number/rev.lux | 14 +- stdlib/source/library/lux/math/random.lux | 8 +- stdlib/source/library/lux/meta.lux | 4 +- stdlib/source/library/lux/meta/configuration.lux | 2 +- stdlib/source/library/lux/meta/symbol.lux | 2 +- stdlib/source/library/lux/static.lux | 4 +- stdlib/source/library/lux/target.lux | 2 +- stdlib/source/library/lux/target/common_lisp.lux | 28 +- stdlib/source/library/lux/target/js.lux | 22 +- stdlib/source/library/lux/target/jvm/attribute.lux | 2 +- stdlib/source/library/lux/target/jvm/bytecode.lux | 60 +- .../lux/target/jvm/bytecode/environment.lux | 2 +- .../lux/target/jvm/bytecode/environment/limit.lux | 2 +- .../jvm/bytecode/environment/limit/registry.lux | 4 +- .../jvm/bytecode/environment/limit/stack.lux | 4 +- .../lux/target/jvm/bytecode/instruction.lux | 44 +- stdlib/source/library/lux/target/jvm/class.lux | 4 +- stdlib/source/library/lux/target/jvm/constant.lux | 10 +- .../library/lux/target/jvm/constant/pool.lux | 116 ++-- .../source/library/lux/target/jvm/constant/tag.lux | 2 +- .../library/lux/target/jvm/encoding/signed.lux | 8 +- .../library/lux/target/jvm/encoding/unsigned.lux | 6 +- stdlib/source/library/lux/target/jvm/field.lux | 2 +- stdlib/source/library/lux/target/jvm/method.lux | 2 +- stdlib/source/library/lux/target/jvm/modifier.lux | 22 +- .../source/library/lux/target/jvm/reflection.lux | 12 +- stdlib/source/library/lux/target/jvm/type.lux | 8 +- .../source/library/lux/target/jvm/type/alias.lux | 2 +- stdlib/source/library/lux/target/jvm/type/box.lux | 2 +- .../library/lux/target/jvm/type/category.lux | 2 +- .../library/lux/target/jvm/type/descriptor.lux | 4 +- stdlib/source/library/lux/target/jvm/type/lux.lux | 10 +- .../source/library/lux/target/jvm/type/parser.lux | 10 +- .../library/lux/target/jvm/type/reflection.lux | 6 +- .../library/lux/target/jvm/type/signature.lux | 6 +- stdlib/source/library/lux/target/jvm/version.lux | 2 +- stdlib/source/library/lux/target/lua.lux | 18 +- stdlib/source/library/lux/target/php.lux | 26 +- stdlib/source/library/lux/target/python.lux | 28 +- stdlib/source/library/lux/target/r.lux | 26 +- stdlib/source/library/lux/target/ruby.lux | 32 +- stdlib/source/library/lux/target/scheme.lux | 20 +- stdlib/source/library/lux/test.lux | 4 +- stdlib/source/library/lux/time.lux | 4 +- stdlib/source/library/lux/time/date.lux | 4 +- stdlib/source/library/lux/time/day.lux | 12 +- stdlib/source/library/lux/time/duration.lux | 10 +- stdlib/source/library/lux/time/instant.lux | 6 +- stdlib/source/library/lux/time/month.lux | 14 +- stdlib/source/library/lux/time/year.lux | 4 +- stdlib/source/library/lux/tool/compiler/arity.lux | 2 +- .../library/lux/tool/compiler/default/platform.lux | 2 +- .../lux/tool/compiler/language/lux/analysis.lux | 51 +- .../compiler/language/lux/analysis/coverage.lux | 8 +- .../compiler/language/lux/analysis/inference.lux | 14 +- .../tool/compiler/language/lux/analysis/module.lux | 4 +- .../compiler/language/lux/analysis/pattern.lux | 28 +- .../tool/compiler/language/lux/analysis/simple.lux | 4 +- .../lux/tool/compiler/language/lux/directive.lux | 6 +- .../lux/tool/compiler/language/lux/generation.lux | 8 +- .../tool/compiler/language/lux/phase/analysis.lux | 96 +-- .../compiler/language/lux/phase/analysis/case.lux | 2 +- .../language/lux/phase/analysis/complex.lux | 4 +- .../language/lux/phase/analysis/simple.lux | 2 +- .../language/lux/phase/extension/analysis/jvm.lux | 57 +- .../language/lux/phase/extension/analysis/lua.lux | 2 +- .../language/lux/phase/extension/directive/jvm.lux | 16 +- .../language/lux/phase/extension/directive/lux.lux | 10 +- .../extension/generation/common_lisp/common.lux | 5 +- .../lux/phase/extension/generation/js/common.lux | 6 +- .../lux/phase/extension/generation/js/host.lux | 2 +- .../lux/phase/extension/generation/jvm/common.lux | 14 +- .../lux/phase/extension/generation/jvm/host.lux | 28 +- .../lux/phase/extension/generation/lua/common.lux | 9 +- .../lux/phase/extension/generation/lua/host.lux | 2 +- .../lux/phase/extension/generation/php/common.lux | 5 +- .../lux/phase/extension/generation/php/host.lux | 2 +- .../phase/extension/generation/python/common.lux | 6 +- .../lux/phase/extension/generation/python/host.lux | 2 +- .../lux/phase/extension/generation/r/common.lux | 5 +- .../lux/phase/extension/generation/ruby/common.lux | 6 +- .../lux/phase/extension/generation/ruby/host.lux | 2 +- .../phase/extension/generation/scheme/common.lux | 5 +- .../lux/phase/extension/generation/scheme/host.lux | 2 +- .../language/lux/phase/generation/common_lisp.lux | 4 +- .../lux/phase/generation/common_lisp/case.lux | 10 +- .../lux/phase/generation/common_lisp/runtime.lux | 9 +- .../compiler/language/lux/phase/generation/js.lux | 2 +- .../language/lux/phase/generation/js/case.lux | 14 +- .../language/lux/phase/generation/js/runtime.lux | 4 +- .../compiler/language/lux/phase/generation/jvm.lux | 2 +- .../language/lux/phase/generation/jvm/case.lux | 6 +- .../lux/phase/generation/jvm/primitive.lux | 10 +- .../lux/phase/generation/jvm/reference.lux | 2 +- .../language/lux/phase/generation/jvm/runtime.lux | 2 +- .../language/lux/phase/generation/jvm/value.lux | 4 +- .../compiler/language/lux/phase/generation/lua.lux | 2 +- .../language/lux/phase/generation/lua/case.lux | 10 +- .../lux/phase/generation/lua/primitive.lux | 2 +- .../language/lux/phase/generation/lua/runtime.lux | 2 +- .../compiler/language/lux/phase/generation/php.lux | 12 +- .../language/lux/phase/generation/php/case.lux | 12 +- .../language/lux/phase/generation/php/runtime.lux | 2 +- .../language/lux/phase/generation/python.lux | 6 +- .../language/lux/phase/generation/python/case.lux | 8 +- .../lux/phase/generation/python/primitive.lux | 2 +- .../lux/phase/generation/python/runtime.lux | 6 +- .../compiler/language/lux/phase/generation/r.lux | 4 +- .../language/lux/phase/generation/r/case.lux | 8 +- .../language/lux/phase/generation/r/primitive.lux | 2 +- .../lux/phase/generation/r/procedure/common.lux | 12 +- .../lux/phase/generation/r/procedure/host.lux | 2 +- .../language/lux/phase/generation/r/runtime.lux | 8 +- .../language/lux/phase/generation/reference.lux | 2 +- .../language/lux/phase/generation/ruby.lux | 6 +- .../language/lux/phase/generation/ruby/case.lux | 10 +- .../lux/phase/generation/ruby/primitive.lux | 2 +- .../language/lux/phase/generation/ruby/runtime.lux | 23 +- .../language/lux/phase/generation/scheme.lux | 4 +- .../language/lux/phase/generation/scheme/case.lux | 8 +- .../phase/generation/scheme/extension/common.lux | 8 +- .../lux/phase/generation/scheme/primitive.lux | 2 +- .../lux/phase/generation/scheme/runtime.lux | 6 +- .../tool/compiler/language/lux/phase/synthesis.lux | 4 +- .../compiler/language/lux/phase/synthesis/case.lux | 24 +- .../language/lux/phase/synthesis/function.lux | 9 +- .../compiler/language/lux/phase/synthesis/loop.lux | 4 +- .../language/lux/phase/synthesis/variable.lux | 8 +- .../lux/tool/compiler/language/lux/syntax.lux | 295 ++++---- .../lux/tool/compiler/language/lux/synthesis.lux | 146 ++-- .../compiler/language/lux/synthesis/simple.lux | 6 +- .../library/lux/tool/compiler/meta/archive.lux | 2 +- .../compiler/meta/archive/artifact/category.lux | 2 +- .../compiler/meta/archive/module/descriptor.lux | 2 +- .../lux/tool/compiler/meta/archive/registry.lux | 8 +- .../compiler/meta/cache/dependency/artifact.lux | 4 +- .../source/library/lux/tool/compiler/meta/cli.lux | 2 +- .../lux/tool/compiler/meta/cli/compiler.lux | 2 +- .../library/lux/tool/compiler/meta/context.lux | 2 +- .../library/lux/tool/compiler/meta/io/archive.lux | 2 +- stdlib/source/library/lux/tool/compiler/phase.lux | 9 +- .../source/library/lux/tool/compiler/reference.lux | 29 +- .../lux/tool/compiler/reference/variable.lux | 9 +- stdlib/source/library/lux/type.lux | 32 +- stdlib/source/library/lux/type/check.lux | 26 +- stdlib/source/library/lux/type/poly.lux | 8 +- stdlib/source/library/lux/type/primitive.lux | 46 +- stdlib/source/library/lux/type/quotient.lux | 2 +- stdlib/source/library/lux/type/refinement.lux | 2 +- stdlib/source/library/lux/type/resource.lux | 6 +- stdlib/source/library/lux/type/unit.lux | 8 +- stdlib/source/library/lux/type/variance.lux | 22 +- stdlib/source/library/lux/world/console.lux | 43 +- stdlib/source/library/lux/world/db/jdbc.lux | 4 +- stdlib/source/library/lux/world/db/jdbc/input.lux | 8 +- stdlib/source/library/lux/world/db/jdbc/output.lux | 6 +- stdlib/source/library/lux/world/db/sql.lux | 32 +- stdlib/source/library/lux/world/file.lux | 69 +- stdlib/source/library/lux/world/file/watch.lux | 4 +- stdlib/source/library/lux/world/input/keyboard.lux | 4 +- .../source/library/lux/world/net/http/client.lux | 2 +- .../source/library/lux/world/net/http/cookie.lux | 4 +- stdlib/source/library/lux/world/net/http/mime.lux | 2 +- .../source/library/lux/world/net/http/response.lux | 2 +- stdlib/source/library/lux/world/net/http/route.lux | 4 +- .../source/library/lux/world/net/http/status.lux | 2 +- .../source/library/lux/world/net/http/version.lux | 2 +- .../library/lux/world/output/video/resolution.lux | 2 +- stdlib/source/library/lux/world/program.lux | 4 +- stdlib/source/library/lux/world/shell.lux | 10 +- stdlib/source/poly/lux/abstract/equivalence.lux | 6 +- stdlib/source/poly/lux/data/format/json.lux | 8 +- stdlib/source/program/aedifex.lux | 2 +- stdlib/source/program/aedifex/artifact.lux | 2 +- .../source/program/aedifex/artifact/extension.lux | 2 +- .../source/program/aedifex/artifact/snapshot.lux | 2 +- .../program/aedifex/artifact/snapshot/version.lux | 2 +- stdlib/source/program/aedifex/artifact/type.lux | 2 +- .../source/program/aedifex/artifact/versioning.lux | 2 +- stdlib/source/program/aedifex/command/build.lux | 8 +- .../program/aedifex/command/deploy/release.lux | 4 +- stdlib/source/program/aedifex/command/test.lux | 2 +- .../program/aedifex/dependency/resolution.lux | 4 +- stdlib/source/program/aedifex/format.lux | 2 +- stdlib/source/program/aedifex/hash.lux | 12 +- .../source/program/aedifex/metadata/artifact.lux | 4 +- .../source/program/aedifex/metadata/snapshot.lux | 4 +- stdlib/source/program/aedifex/package.lux | 2 +- stdlib/source/program/aedifex/pom.lux | 2 +- stdlib/source/program/aedifex/profile.lux | 2 +- .../source/program/aedifex/repository/remote.lux | 2 +- stdlib/source/program/aedifex/runtime.lux | 2 +- .../specification/compositor/analysis/type.lux | 2 +- .../specification/compositor/generation/case.lux | 2 +- .../specification/compositor/generation/common.lux | 12 +- .../compositor/generation/primitive.lux | 2 +- stdlib/source/specification/lux/world/shell.lux | 2 +- stdlib/source/test/aedifex/artifact/extension.lux | 2 +- stdlib/source/test/aedifex/command/build.lux | 4 +- .../source/test/aedifex/dependency/resolution.lux | 2 +- stdlib/source/test/aedifex/hash.lux | 6 +- stdlib/source/test/aedifex/runtime.lux | 2 +- stdlib/source/test/lux.lux | 20 +- stdlib/source/test/lux/abstract/interval.lux | 2 +- stdlib/source/test/lux/control/concatenative.lux | 45 +- stdlib/source/test/lux/control/function/inline.lux | 5 +- stdlib/source/test/lux/control/parser/analysis.lux | 15 +- stdlib/source/test/lux/control/parser/binary.lux | 27 +- stdlib/source/test/lux/control/parser/cli.lux | 15 +- stdlib/source/test/lux/control/parser/code.lux | 19 +- stdlib/source/test/lux/control/parser/json.lux | 17 +- .../source/test/lux/control/parser/synthesis.lux | 17 +- stdlib/source/test/lux/control/parser/text.lux | 15 +- stdlib/source/test/lux/control/parser/tree.lux | 59 +- stdlib/source/test/lux/control/parser/type.lux | 19 +- stdlib/source/test/lux/control/parser/xml.lux | 36 +- stdlib/source/test/lux/data.lux | 11 +- stdlib/source/test/lux/data/binary.lux | 2 +- stdlib/source/test/lux/data/collection/list.lux | 2 +- .../source/test/lux/data/collection/set/multi.lux | 2 +- .../test/lux/data/collection/set/ordered.lux | 4 +- stdlib/source/test/lux/data/color.lux | 8 +- stdlib/source/test/lux/data/color/named.lux | 6 +- stdlib/source/test/lux/data/format/json.lux | 4 +- stdlib/source/test/lux/data/format/tar.lux | 6 +- stdlib/source/test/lux/data/format/xml.lux | 2 +- stdlib/source/test/lux/data/text.lux | 6 +- stdlib/source/test/lux/data/text/encoding.lux | 6 +- stdlib/source/test/lux/data/text/escape.lux | 2 +- stdlib/source/test/lux/data/text/format.lux | 4 +- stdlib/source/test/lux/data/text/unicode/block.lux | 6 +- stdlib/source/test/lux/data/text/unicode/set.lux | 2 +- stdlib/source/test/lux/debug.lux | 12 +- stdlib/source/test/lux/documentation.lux | 2 +- stdlib/source/test/lux/extension.lux | 4 +- stdlib/source/test/lux/ffi.js.lux | 4 +- stdlib/source/test/lux/ffi.jvm.lux | 6 +- stdlib/source/test/lux/ffi.lua.lux | 4 +- stdlib/source/test/lux/ffi.old.lux | 8 +- stdlib/source/test/lux/ffi.py.lux | 4 +- stdlib/source/test/lux/ffi.rb.lux | 4 +- stdlib/source/test/lux/ffi/export.jvm.lux | 8 +- stdlib/source/test/lux/locale/language.lux | 13 +- stdlib/source/test/lux/locale/territory.lux | 13 +- stdlib/source/test/lux/macro.lux | 18 +- stdlib/source/test/lux/macro/code.lux | 4 +- stdlib/source/test/lux/macro/pattern.lux | 11 +- stdlib/source/test/lux/math.lux | 8 +- stdlib/source/test/lux/math/logic/continuous.lux | 2 +- stdlib/source/test/lux/math/modular.lux | 2 +- stdlib/source/test/lux/math/number.lux | 6 +- stdlib/source/test/lux/math/number/frac.lux | 4 +- stdlib/source/test/lux/math/number/int.lux | 4 +- stdlib/source/test/lux/math/number/nat.lux | 4 +- stdlib/source/test/lux/math/number/ratio.lux | 2 +- stdlib/source/test/lux/math/number/rev.lux | 6 +- stdlib/source/test/lux/meta.lux | 9 +- stdlib/source/test/lux/static.lux | 2 +- stdlib/source/test/lux/target/js.lux | 14 +- stdlib/source/test/lux/target/jvm.lux | 63 +- stdlib/source/test/lux/target/lua.lux | 10 +- stdlib/source/test/lux/target/python.lux | 14 +- stdlib/source/test/lux/target/ruby.lux | 8 +- stdlib/source/test/lux/time.lux | 2 +- stdlib/source/test/lux/time/duration.lux | 2 +- .../lux/tool/compiler/language/lux/analysis.lux | 17 +- .../compiler/language/lux/analysis/coverage.lux | 6 +- .../compiler/language/lux/analysis/inference.lux | 6 +- .../tool/compiler/language/lux/analysis/module.lux | 18 +- .../compiler/language/lux/analysis/pattern.lux | 2 +- .../tool/compiler/language/lux/analysis/scope.lux | 2 +- .../tool/compiler/language/lux/phase/analysis.lux | 12 +- .../language/lux/phase/analysis/complex.lux | 4 +- .../language/lux/phase/analysis/simple.lux | 19 +- .../language/lux/phase/extension/analysis/lux.lux | 2 +- .../compiler/language/lux/phase/synthesis/case.lux | 2 +- .../language/lux/phase/synthesis/function.lux | 17 +- .../compiler/language/lux/phase/synthesis/loop.lux | 8 +- .../language/lux/phase/synthesis/primitive.lux | 4 +- .../language/lux/phase/synthesis/variable.lux | 19 +- .../lux/tool/compiler/meta/archive/registry.lux | 23 +- .../test/lux/tool/compiler/meta/cache/module.lux | 2 +- stdlib/source/test/lux/tool/compiler/meta/cli.lux | 8 +- .../source/test/lux/tool/compiler/meta/context.lux | 2 +- stdlib/source/test/lux/tool/compiler/reference.lux | 2 +- stdlib/source/test/lux/tool/compiler/version.lux | 2 +- stdlib/source/test/lux/type.lux | 4 +- stdlib/source/test/lux/type/check.lux | 10 +- stdlib/source/test/lux/type/primitive.lux | 2 +- stdlib/source/test/lux/type/resource.lux | 8 +- stdlib/source/test/lux/type/unit.lux | 10 +- stdlib/source/test/lux/world/input/keyboard.lux | 8 +- stdlib/source/test/lux/world/net/http/client.lux | 6 +- stdlib/source/test/lux/world/net/http/status.lux | 6 +- stdlib/source/unsafe/lux/data/binary.lux | 391 +++++------ stdlib/source/unsafe/lux/data/collection/array.lux | 750 +++++++++++---------- 411 files changed, 2869 insertions(+), 2677 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 59a5159b4..25389845a 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -284,7 +284,7 @@ (documentation: /.template "" ["By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary." - (template [ ] + (with_template [ ] [(def: .public (-> Int Int) (+ ))] @@ -433,9 +433,9 @@ [(def: .public symbol (macro (_ tokens) (case tokens - (^template [] - [(pattern (list [_ { [module name]}])) - (in (list (` [(~ (text$ module)) (~ (text$ name))])))]) + (^with_template [] + [(pattern (list [_ { [module name]}])) + (in (list (` [(~ (text$ module)) (~ (text$ name))])))]) ([#Symbol]) _ @@ -516,7 +516,7 @@ (is (-> a a Bit) <)))]) -(.template [] +(.with_template [] [(documentation: "Safe type-casting for I64 values.")] @@ -642,17 +642,17 @@ ... {.#Primitive name params} ... {.#Primitive name (list#each (reduced env) params)} -... (^template [] +... (^with_template [] ... [{ left right} ... { (reduced env left) (reduced env right)}]) ... ([.#Sum] [.#Product]) -... (^template [] +... (^with_template [] ... [{ left right} ... { (reduced env left) (reduced env right)}]) ... ([.#Function] [.#Apply]) -... (^template [] +... (^with_template [] ... [{ old_env def} ... (case old_env ... {.#End} @@ -669,7 +669,7 @@ ... type ... ))]) -(.template [ ] +(.with_template [ ] [(documentation: )] @@ -699,7 +699,7 @@ [(def: test Test (with_expansions - [ (template [ ] + [ (with_template [ ] [(cover [] (compare (at codec encoded )))] @@ -825,11 +825,12 @@ "==" Int]) -(documentation: /.template: - (format "Define macros in the style of template and ^template." +(documentation: /.template + (format "Define macros in the style of with_template." \n "For simple macros that do not need any fancy features.") - [(template: (square x) - (* x x))]) + [(def: square + (template (square x) + (* x x)))]) (documentation: /.these (format "Given a (potentially empty) list of codes, just returns them immediately, without any work done." @@ -999,7 +1000,7 @@ ..as_expected ..undefined ..type_of - ..template: + ..template ..these ..char ..for diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index 635d0ab7e..aa750bda1 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -51,7 +51,7 @@ [(is (=> [Nat] [Nat]) ((apply 1) ++))]) -(template [] +(with_template [] [(with_expansions [ (template.symbol [/._] ["apply_" ]) (template.text ["Lift a function of arity " " into a concatenative function of arity " "."])] @@ -92,7 +92,7 @@ (documentation: /.||R "Right-injects the top into sum.") -(template [ ] +(with_template [ ] [(`` (documentation: (~~ (template.symbol [/._] [])) (~~ (template.text [ " for " " arithmetic."]))))] diff --git a/stdlib/source/documentation/lux/control/parser/analysis.lux b/stdlib/source/documentation/lux/control/parser/analysis.lux index 4eeb442fe..7f61c1dca 100644 --- a/stdlib/source/documentation/lux/control/parser/analysis.lux +++ b/stdlib/source/documentation/lux/control/parser/analysis.lux @@ -26,7 +26,7 @@ (documentation: /.end? "Checks whether there are no more inputs.") -(template [ ] +(with_template [ ] [(`` (these (`` (documentation: (format "Queries for a " (~~ (template.text [])) " value."))) (`` (documentation: diff --git a/stdlib/source/documentation/lux/control/parser/binary.lux b/stdlib/source/documentation/lux/control/parser/binary.lux index 42a25e1e3..7a890c827 100644 --- a/stdlib/source/documentation/lux/control/parser/binary.lux +++ b/stdlib/source/documentation/lux/control/parser/binary.lux @@ -42,7 +42,7 @@ "Parses a chunk of data of a given size." [(segment size)]) -(template [ ] +(with_template [ ] [(documentation: (format "Parses a block of data prefixed with a size that is " (%.nat ) " bytes long."))] @@ -52,7 +52,7 @@ [64 /.binary_64] ) -(template [ ] +(with_template [ ] [(documentation: (format "Parses a block of (UTF-8 encoded) text prefixed with a size that is " (%.nat ) " bytes long."))] @@ -62,7 +62,7 @@ [64 /.utf8_64] ) -(template [ ] +(with_template [ ] [(documentation: (format "Parses a sequence of values prefixed with a size that is " (%.nat ) " bytes long."))] diff --git a/stdlib/source/documentation/lux/control/parser/code.lux b/stdlib/source/documentation/lux/control/parser/code.lux index fe1136b89..a742e1bbb 100644 --- a/stdlib/source/documentation/lux/control/parser/code.lux +++ b/stdlib/source/documentation/lux/control/parser/code.lux @@ -16,7 +16,7 @@ (documentation: /.any "Yields the next input without applying any logic.") -(template [ ] +(with_template [ ] [(`` (documentation: (format "Parses the next " (~~ (template.text [])) " input."))) (`` (documentation: @@ -35,7 +35,7 @@ "Ensures the given Code is the next input." [(this code)]) -(template [ ] +(with_template [ ] [(documentation: (format "Parse a local " " (a " " that has no module prefix).")) (documentation: @@ -44,7 +44,7 @@ [/.local /.this_local "local symbol"] ) -(template [] +(with_template [] [(`` (documentation: (format "Parses the contents of a " (~~ (template.text [])) ".")))] diff --git a/stdlib/source/documentation/lux/control/parser/json.lux b/stdlib/source/documentation/lux/control/parser/json.lux index ba2c434ef..0c554c35e 100644 --- a/stdlib/source/documentation/lux/control/parser/json.lux +++ b/stdlib/source/documentation/lux/control/parser/json.lux @@ -21,7 +21,7 @@ (documentation: /.any "Just returns the JSON input without applying any logic.") -(template [] +(with_template [] [(`` (documentation: (format "Reads a JSON value as " (~~ (template.text [])) ".")))] @@ -31,7 +31,7 @@ [/.string] ) -(template [ ] +(with_template [ ] [(`` (documentation: (format "Asks whether a JSON value is a " (~~ (template.text [])) "."))) (`` (documentation: diff --git a/stdlib/source/documentation/lux/control/parser/synthesis.lux b/stdlib/source/documentation/lux/control/parser/synthesis.lux index 137d08ba1..40a73b496 100644 --- a/stdlib/source/documentation/lux/control/parser/synthesis.lux +++ b/stdlib/source/documentation/lux/control/parser/synthesis.lux @@ -27,7 +27,7 @@ (documentation: /.end? "Checks whether there are no more inputs.") -(template [ ] +(with_template [ ] [(`` (documentation: (format "Queries for a " (~~ (template.text [])) " synthesis node."))) (`` (documentation: diff --git a/stdlib/source/documentation/lux/control/parser/text.lux b/stdlib/source/documentation/lux/control/parser/text.lux index db886a7b4..f399d4886 100644 --- a/stdlib/source/documentation/lux/control/parser/text.lux +++ b/stdlib/source/documentation/lux/control/parser/text.lux @@ -33,7 +33,7 @@ (documentation: /.any! "Yields the next character (as a slice) without applying any logic.") -(template [ ] +(with_template [ ] [(`` (documentation: (format "Produce a character" (~~ (template.text [])) " if the parser fails.")))] @@ -58,7 +58,7 @@ "Only yields characters within a range." [(range bottom top)]) -(template [ ] +(with_template [ ] [(documentation: (format "Only yields " " characters."))] @@ -77,7 +77,7 @@ (documentation: /.hexadecimal "Yields hexadecimal digits.") -(template [ ] +(with_template [ ] [(documentation: (format "Yields characters that are" " part of a piece of text."))] @@ -85,7 +85,7 @@ [/.none_of " not"] ) -(template [ ] +(with_template [ ] [(documentation: (format "Yields characters (as a slice) that are" " part of a piece of text."))] @@ -108,7 +108,7 @@ "Yields the outputs of both parsers composed together (as a slice)." [(and! left right)]) -(template [ ] +(with_template [ ] [(`` (documentation: (format "Yields " (~~ (template.text [])) " characters as a single continuous text."))) (`` (documentation: @@ -118,7 +118,7 @@ [/.many /.many!] ) -(template [ ] +(with_template [ ] [(`` (documentation: (format "Yields " " N characters."))) (`` (documentation: diff --git a/stdlib/source/documentation/lux/control/parser/tree.lux b/stdlib/source/documentation/lux/control/parser/tree.lux index d200cdfe7..af653e30c 100644 --- a/stdlib/source/documentation/lux/control/parser/tree.lux +++ b/stdlib/source/documentation/lux/control/parser/tree.lux @@ -24,7 +24,7 @@ (documentation: /.value "Yields the value inside the current tree node.") -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/control/parser/type.lux b/stdlib/source/documentation/lux/control/parser/type.lux index fa326176f..0aa20cac6 100644 --- a/stdlib/source/documentation/lux/control/parser/type.lux +++ b/stdlib/source/documentation/lux/control/parser/type.lux @@ -41,7 +41,7 @@ "" [(with_extension type poly)]) -(template [] +(with_template [] [(`` (documentation: (format "Parses the contents of a " (~~ (template.text [])) " type.")))] @@ -61,7 +61,7 @@ "Parses a type application." [(applied poly)]) -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux index 0558eaed0..2120ef800 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux @@ -29,7 +29,7 @@ "" [(key? dict key)]) -(template [] +(with_template [] [(`` (documentation: (format "Yields value under the " (~~ (template.text [])) "imum key.")))] diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index 28b8011f1..2da969a32 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -90,7 +90,7 @@ "" [(member? eq xs x)]) -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux index a3d452f5f..c82870c35 100644 --- a/stdlib/source/documentation/lux/data/color.lux +++ b/stdlib/source/documentation/lux/data/color.lux @@ -67,7 +67,7 @@ (documentation: /.Pigment "A color with some degree of transparency.") -(template [] +(with_template [] [(`` (documentation: (format "A " (text.replaced "_" "-" (~~ (template.text []))) diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux index 398a4d7ef..d09e90390 100644 --- a/stdlib/source/documentation/lux/data/color/named.lux +++ b/stdlib/source/documentation/lux/data/color/named.lux @@ -18,7 +18,7 @@ ["[0]" / ["/[1]" //]]]) -(template [] +(with_template [] [(documentation: (let [[red green blue] (//.rgb ) [_ name] (symbol )] diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index 866fd5682..a2ea2866e 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -37,7 +37,7 @@ "A JSON object field setter." [(has key value json)]) -(template [ ] +(with_template [ ] [(documentation: (format "A JSON object field getter for " "."))] diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux index 792b904d0..ab9a71016 100644 --- a/stdlib/source/documentation/lux/data/text/encoding.lux +++ b/stdlib/source/documentation/lux/data/text/encoding.lux @@ -15,7 +15,7 @@ (documentation: /.Encoding "Encoding formats for text.") -(template [] +(with_template [] [(documentation: (format "'" (/.name ) "' text encoding. "))] diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux index 3214f6038..de00765eb 100644 --- a/stdlib/source/documentation/lux/data/text/unicode/block.lux +++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux @@ -24,7 +24,7 @@ "" [(within? block char)]) -(template [] +(with_template [] [(documentation: (let [[_ name] (symbol )] (format (hex#encoded (/.start )) diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index 22bd01753..8c4c37046 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(template [] +(with_template [] [(`` (documentation: (format "The type of a (boxed) " (~~ (template.text [])) " object.")))] @@ -24,7 +24,7 @@ [/.Character] ) -(template [] +(with_template [] [(`` (documentation: (format "The type of an (unboxed) " (~~ (template.text [])) " value.")))] @@ -38,7 +38,7 @@ [/.char] ) -(template [ ] +(with_template [ ] [(`` (documentation: "Type converter."))] diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 863749adf..3f22f8fd2 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(template [ ] +(with_template [ ] [(documentation: "Type converter.")] diff --git a/stdlib/source/documentation/lux/math/number.lux b/stdlib/source/documentation/lux/math/number.lux index 90dce2151..2625f99d3 100644 --- a/stdlib/source/documentation/lux/math/number.lux +++ b/stdlib/source/documentation/lux/math/number.lux @@ -21,7 +21,7 @@ ["[1][0]" ratio] ["[1][0]" complex]]) -(template [ ] +(with_template [ ] [(documentation: (format "Given syntax for a " " number, generates a Nat, an Int, a Rev or a Frac.") [] diff --git a/stdlib/source/documentation/lux/math/number/frac.lux b/stdlib/source/documentation/lux/math/number/frac.lux index 57fd3dbd1..7e7cfa502 100644 --- a/stdlib/source/documentation/lux/math/number/frac.lux +++ b/stdlib/source/documentation/lux/math/number/frac.lux @@ -30,7 +30,7 @@ "Frac(tion) greater-than or equal." [(>= reference sample)]) -(template [ ] +(with_template [ ] [(documentation: )] @@ -45,7 +45,7 @@ "" [(/% param subject)]) -(template [ ] +(with_template [ ] [(documentation: )] @@ -53,7 +53,7 @@ [/.max "Frac(tion) minimum."] ) -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/math/number/i64.lux b/stdlib/source/documentation/lux/math/number/i64.lux index f69796e97..d9bf765ca 100644 --- a/stdlib/source/documentation/lux/math/number/i64.lux +++ b/stdlib/source/documentation/lux/math/number/i64.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(template [ ] +(with_template [ ] [(documentation: )] @@ -43,7 +43,7 @@ "Count the number of 1s in a bit-map." [(ones it)]) -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/math/number/int.lux b/stdlib/source/documentation/lux/math/number/int.lux index 6a2f7ef24..646220cc3 100644 --- a/stdlib/source/documentation/lux/math/number/int.lux +++ b/stdlib/source/documentation/lux/math/number/int.lux @@ -30,7 +30,7 @@ "Int(eger) greater-than or equal." [(>= reference sample)]) -(template [ ] +(with_template [ ] [(documentation: )] @@ -38,7 +38,7 @@ [/.max "Int(eger) maximum."] ) -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/math/number/nat.lux b/stdlib/source/documentation/lux/math/number/nat.lux index f830b17fd..6f79389c7 100644 --- a/stdlib/source/documentation/lux/math/number/nat.lux +++ b/stdlib/source/documentation/lux/math/number/nat.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(template [ ] +(with_template [ ] [(documentation: )] @@ -27,7 +27,7 @@ [/.% "Nat(ural) remainder."] ) -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/math/number/rev.lux b/stdlib/source/documentation/lux/math/number/rev.lux index 30bf3821b..39dc43660 100644 --- a/stdlib/source/documentation/lux/math/number/rev.lux +++ b/stdlib/source/documentation/lux/math/number/rev.lux @@ -30,7 +30,7 @@ "Rev(olution) greater-than or equal." [(>= reference sample)]) -(template [ ] +(with_template [ ] [(documentation: )] @@ -38,7 +38,7 @@ [/.max "Rev(olution) maximum."] ) -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux index 6b820161b..ab822cb92 100644 --- a/stdlib/source/documentation/lux/static.lux +++ b/stdlib/source/documentation/lux/static.lux @@ -10,7 +10,7 @@ [\\library ["[0]" /]]) -(template [ ] +(with_template [ ] [(documentation: (%.code (' ( (is @@ -31,7 +31,7 @@ (is ??? (value generating expression)))]) -(template [ ] +(with_template [ ] [(documentation: (%.code (' (is ()))))] diff --git a/stdlib/source/documentation/lux/time.lux b/stdlib/source/documentation/lux/time.lux index 6337f6e1b..9e460146c 100644 --- a/stdlib/source/documentation/lux/time.lux +++ b/stdlib/source/documentation/lux/time.lux @@ -20,7 +20,7 @@ ["[1][0]" month] ["[1][0]" year]]) -(template [ ] +(with_template [ ] [(documentation: )] diff --git a/stdlib/source/documentation/lux/type.lux b/stdlib/source/documentation/lux/type.lux index d1aef3ff2..138986636 100644 --- a/stdlib/source/documentation/lux/type.lux +++ b/stdlib/source/documentation/lux/type.lux @@ -24,7 +24,7 @@ ["[1][0]" unit] ["[1][0]" variance]]) -(template [] +(with_template [] [(documentation: "The number of parameters, and the body, of a quantified type.")] @@ -40,7 +40,7 @@ "The quantified type, and its parameters, for a type-application." [(flat_application type)]) -(template [] +(with_template [] [(documentation: "The members of a composite type.")] @@ -69,7 +69,7 @@ "A type without any names covering it." [(anonymous type)]) -(template [] +(with_template [] [(documentation: "A composite type, constituted by the given member types.")] @@ -85,7 +85,7 @@ "An un-evaluated type application, with the given quantified type, and parameters." [(application params quant)]) -(template [] +(with_template [] [(documentation: "A quantified type, with the given number of parameters, and body.")] diff --git a/stdlib/source/documentation/lux/type/primitive.lux b/stdlib/source/documentation/lux/type/primitive.lux index ea7ca95ea..6d9e20762 100644 --- a/stdlib/source/documentation/lux/type/primitive.lux +++ b/stdlib/source/documentation/lux/type/primitive.lux @@ -23,7 +23,7 @@ "A specific abstract/nominal type still being defined somewhere in the scope." [(specific name)]) -(template [ <$> ] +(with_template [ <$> ] [(documentation: "Type-casting macro for abstract/nominal types." [(|> value diff --git a/stdlib/source/documentation/lux/type/resource.lux b/stdlib/source/documentation/lux/type/resource.lux index bc3e8f0f0..a216b3082 100644 --- a/stdlib/source/documentation/lux/type/resource.lux +++ b/stdlib/source/documentation/lux/type/resource.lux @@ -51,7 +51,7 @@ (format "A resource locked by a key." \n "The 'key' represents the right to access/consume a resource.")) -(template [] +(with_template [] [(documentation: "Makes a value into a resource and adds the key/access-right to it to the ambient keyring for future use.")] @@ -75,7 +75,7 @@ right (read ! res|right)] (in (format left right)))]) -(template [] +(with_template [] [(documentation: "Group/un-group keys in the keyring into/out-of tuples." [(do (monad !) diff --git a/stdlib/source/documentation/lux/type/unit.lux b/stdlib/source/documentation/lux/type/unit.lux index 4a8dbd8b1..3a80b367c 100644 --- a/stdlib/source/documentation/lux/type/unit.lux +++ b/stdlib/source/documentation/lux/type/unit.lux @@ -42,7 +42,7 @@ "" [(re_scaled from to quantity)]) -(template [ ] +(with_template [ ] [(`` (documentation: (let [numerator (the [/.ratio ratio.#numerator] ) denominator (the [/.ratio ratio.#denominator] )] @@ -57,7 +57,7 @@ [/.Nano /.nano] ) -(template [] +(with_template [] [(`` (documentation: (format "The '" (~~ (template.text [])) "' unit of meaurement.")))] diff --git a/stdlib/source/documentation/lux/world/net/http/client.lux b/stdlib/source/documentation/lux/world/net/http/client.lux index 2f44944ca..0a779634d 100644 --- a/stdlib/source/documentation/lux/world/net/http/client.lux +++ b/stdlib/source/documentation/lux/world/net/http/client.lux @@ -17,7 +17,7 @@ (documentation: (/.Client !) "A HTTP client capable of issuing requests to a HTTP server.") -(template [] +(with_template [] [(documentation: (format "A " (text.upper_cased (template.text [])) " request."))] diff --git a/stdlib/source/documentation/lux/world/net/http/status.lux b/stdlib/source/documentation/lux/world/net/http/status.lux index 2ccf8d681..9d34e7487 100644 --- a/stdlib/source/documentation/lux/world/net/http/status.lux +++ b/stdlib/source/documentation/lux/world/net/http/status.lux @@ -13,7 +13,7 @@ [\\library ["[0]" /]]) -(template [] +(with_template [] [(documentation: (|> (template.text []) (text.replaced "_" " ") diff --git a/stdlib/source/documentation/lux/world/output/video/resolution.lux b/stdlib/source/documentation/lux/world/output/video/resolution.lux index 65aa9d860..f6881ac34 100644 --- a/stdlib/source/documentation/lux/world/output/video/resolution.lux +++ b/stdlib/source/documentation/lux/world/output/video/resolution.lux @@ -16,7 +16,7 @@ (documentation: /.Resolution "A screen resolution.") -(template [] +(with_template [] [(documentation: (let [name (|> (template.text []) (text.replaced "_" " ") diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 0b45af385..1a35551fa 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1940,7 +1940,7 @@ (-> ($' List ($' List a)) ($' List a))) (list#mix list#composite {#End} (list#reversed xs))) -(def:'' .public template +(def:'' .public with_template Macro (macro (_ tokens) ({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]} @@ -1954,15 +1954,15 @@ (list#each (function#composite apply (replacement_environment bindings'))) list#conjoint meta#in) - (failure "Irregular arguments tuples for template."))) + (failure (..wrong_syntax_error [..prelude_module "with_template"])))) _ - (failure "Wrong syntax for template")} + (failure (..wrong_syntax_error [..prelude_module "with_template"]))} [(monad#each maybe_monad symbol_short bindings) (monad#each maybe_monad tuple_list data)]) _ - (failure "Wrong syntax for template")} + (failure (..wrong_syntax_error [..prelude_module "with_template"]))} tokens))) (def:''' .private (n// param subject) @@ -2415,7 +2415,7 @@ _ #0} xs)) -(template [ ] +(with_template [ ] [(def:''' .private ( xy) (All (_ a b) (-> (Tuple a b) )) @@ -2809,7 +2809,7 @@ _ {#None})) -(template [ ] +(with_template [ ] [(def:' .private ( tokens) (-> (List Code) (Maybe (List ))) (case tokens @@ -2827,7 +2827,7 @@ [enhanced_parametersP Code anyP] ) -(template [ ] +(with_template [ ] [(def:' .private ( tokens) (Parser [Text (List )]) (case tokens @@ -2868,7 +2868,7 @@ _ [tokens (` .private)])) -(template [ ] +(with_template [ ] [(def:' .private ( tokens) (-> (List Code) (Maybe [(List Code) [Code Text (List )]])) (do maybe_monad @@ -2956,7 +2956,7 @@ {#Some y} {#Some y}))) -(template [
] +(with_template [ ] [(def: .public (macro (_ tokens) (case (list#reversed tokens) @@ -3090,7 +3090,7 @@ _ {#None})) -(template [ ] +(with_template [ ] [(def: ( type) (-> Type (List Type)) (case type @@ -4543,7 +4543,7 @@ _ (failure "Wrong syntax for pattern#template")))) -(template [ ] +(with_template [ ] [(def: .public (All (_ s) (-> (I64 s) (I64 s))) @@ -4897,19 +4897,19 @@ (failure (..wrong_syntax_error (symbol ..type_of)))))) (def: (templateP tokens) - (-> (List Code) (Maybe [Code Text (List Text) (List Code)])) + (-> (List Code) (Maybe [Text (List Text) (List Code)])) (do maybe_monad - [% (declarationP tokens) - .let' [[tokens [export_policy name parameters]] %] + [% (local_declarationP tokens) + .let' [[tokens [name parameters]] %] % (tupleP (someP anyP) tokens) .let' [[tokens templates] %] _ (endP tokens)] - (in [export_policy name parameters templates]))) + (in [name parameters templates]))) -(def: .public template: +(def: .public template (macro (_ tokens) (case (templateP tokens) - {#Some [export_policy name args input_templates]} + {#Some [name args input_templates]} (do meta_monad [g!tokens (..generated_symbol "tokens") g!compiler (..generated_symbol "compiler") @@ -4918,25 +4918,25 @@ [arg (` ((~' ~) (~ (local$ arg))))]) args)] this_module current_module_name] - (in (list (` (..def: (~ export_policy) (~ (local$ name)) - (..macro ((~ (local$ name)) (~ g!tokens) (~ g!compiler)) - (case (~ g!tokens) - (pattern (list (~+ (list#each local$ args)))) - {.#Right [(~ g!compiler) - (list (~+ (list#each (function (_ template) - (` (`' (~ (with_replacements rep_env - template))))) - input_templates)))]} - - (~ g!_) - {.#Left (~ (text$ (..wrong_syntax_error [this_module name])))}))))))) + (in (list (` (..macro ((~ (local$ name)) (~ g!tokens) (~ g!compiler)) + (case (~ g!tokens) + (pattern (list (~+ (list#each local$ args)))) + {.#Right [(~ g!compiler) + (list (~+ (list#each (function (_ template) + (` (`' (~ (with_replacements rep_env + template))))) + input_templates)))]} + + (~ g!_) + {.#Left "Invalid syntax."})))))) {#None} - (failure (..wrong_syntax_error (symbol ..template:)))))) + (failure (..wrong_syntax_error (symbol ..template)))))) -(template [ ] - [(template: .public ( it) - [(..|> it (..is (..I64 ..Any)) (..as ))])] +(with_template [ ] + [(def: .public + (template ( it) + [(..|> it (..is (..I64 ..Any)) (..as ))]))] [i64 ..I64] [nat ..Nat] diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux index c38e3a75b..2ec0a1fa5 100644 --- a/stdlib/source/library/lux/abstract/interval.lux +++ b/stdlib/source/library/lux/abstract/interval.lux @@ -32,7 +32,7 @@ (def: bottom elem) (def: top elem))) -(template [ ] +(with_template [ ] [(def: .public ( interval) (All (_ a) (-> (Interval a) Bit)) (let [(open ",#[0]") interval] @@ -58,7 +58,7 @@ (and (,#= ,#bottom elem) (,#= ,#top elem))))) -(template [ ] +(with_template [ ] [(def: .public ( elem interval) (All (_ a) (-> a (Interval a) Bit)) (let [(open "[0]") interval] @@ -105,7 +105,7 @@ (All (_ a) (-> (Interval a) (Interval a) Bit)) (precedes? sample reference)) -(template [ ] +(with_template [ ] [(def: .public ( reference sample) (All (_ a) (-> a (Interval a) Bit)) (let [(open ",#[0]") sample] @@ -128,7 +128,7 @@ (or (meets? reference sample) (meets? sample reference))) -(template [ ] +(with_template [ ] [(def: .public ( reference sample) (All (_ a) (-> (Interval a) (Interval a) Bit)) (let [(open ",#[0]") reference] diff --git a/stdlib/source/library/lux/abstract/predicate.lux b/stdlib/source/library/lux/abstract/predicate.lux index 590741de7..10efde28e 100644 --- a/stdlib/source/library/lux/abstract/predicate.lux +++ b/stdlib/source/library/lux/abstract/predicate.lux @@ -11,7 +11,7 @@ (type: .public (Predicate a) (-> a Bit)) -(template [ ] +(with_template [ ] [(def: .public Predicate (function.constant )) @@ -26,7 +26,7 @@ [all #1 and .and] ) -(template [ ] +(with_template [ ] [(implementation: .public (All (_ a) (Monoid (Predicate a))) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 81a5af65d..344af48e8 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -144,7 +144,7 @@ (function ((~ g!_) (~ (stack_mix g!inputs g!stack))) [(~ g!stack) ((~ g!func) (~+ g!inputs))])))))))))) -(template [] +(with_template [] [(`` (def: .public (~~ (template.symbol ["apply_" ])) (..apply )))] @@ -202,7 +202,7 @@ (function (_ [stack r]) [stack {0 #1 r}])) -(template [ ] +(with_template [ ] [(`` (def: .public (=> [ ] []) (function (_ [[stack subject] param]) diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index b933ea350..8882fc928 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -172,7 +172,7 @@ [(Async (Or lr rr)) (Resolver (Or lr rr))] (..async []))] (with_expansions - [ (template [ ] + [ (with_template [ ] [(io.run! (upon! (|>> {} resolve) ))] [left .#Left] @@ -191,7 +191,7 @@ [(Async a) (Resolver a)] (..async []))] (`` (exec - (~~ (template [] + (~~ (with_template [] [(io.run! (upon! resolve ))] [left] diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index a9c93433a..20236531a 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -147,7 +147,7 @@ (again (++ step))) (at async.monad in [])))) - (template [ ] + (with_template [ ] [(def: ( barrier) (-> Barrier (Async Any)) (do async.monad diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux index b5de83e82..fbb5dc725 100644 --- a/stdlib/source/library/lux/control/function/contract.lux +++ b/stdlib/source/library/lux/control/function/contract.lux @@ -15,7 +15,7 @@ [number ["i" int]]]]]) -(template [] +(with_template [] [(exception: .public ( [condition Code]) (exception.report "Condition" (%.code condition)))] diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index ef5e9eecf..50ed5ca0c 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -21,15 +21,17 @@ (All (_ a) (-> (-> Any a) (IO a))) (|>> abstraction)) - (template: (!io computation) - [(abstraction - (template.with_locals [g!func g!arg] - (function (g!func g!arg) - computation)))]) + (def: !io + (template (!io computation) + [(abstraction + (template.with_locals [g!func g!arg] + (function (g!func g!arg) + computation)))])) - (template: (run!' io) - ... creatio ex nihilo - [((representation io) [])]) + (def: run!' + (template (run!' io) + ... creatio ex nihilo + [((representation io) [])])) (def: .public io (syntax (_ [computation .any]) diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux index e23cc495e..ebf4f2ec6 100644 --- a/stdlib/source/library/lux/control/parser/analysis.lux +++ b/stdlib/source/library/lux/control/parser/analysis.lux @@ -88,7 +88,7 @@ {.#End} true _ false)]})) -(template [ ] +(with_template [ ] [(`` (these (def: .public (Parser ) (function (_ input) diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index 36f70c1e0..28f13e9b7 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -43,9 +43,10 @@ "Binary length" (%.nat binary_length) "Bytes read" (%.nat bytes_read))) -(template [ ] - [(template: ( ) - [( )])] +(with_template [ ] + [(def: + (template ( ) + [( )]))] [n#= "lux i64 ="] [n#+ "lux i64 +"] @@ -95,7 +96,7 @@ "Range start" (%.nat start) "Range end" (%.nat end))) -(template [ ] +(with_template [ ] [(def: .public (Parser I64) (function (_ [start binary]) @@ -112,7 +113,7 @@ [bits_64 ..size_64 /.bits_64] ) -(template [ ] +(with_template [ ] [(def: .public (Parser ) ..bits_64)] [nat Nat] @@ -130,17 +131,18 @@ "Tag range" (%.nat range) "Tag value" (%.nat byte))) -(template: (!variant +) - [(do [! //.monad] - [flag (is (Parser Nat) - ..bits_8)] - (with_expansions [+' (template.spliced +)] - (case flag - (^.template [ ] - [ (`` (at ! each (|>> {(~~ (template.spliced ))}) ))]) - (+') - - _ (//.lifted (exception.except ..invalid_tag [(template.amount [+]) flag])))))]) +(def: !variant + (template (!variant +) + [(do [! //.monad] + [flag (is (Parser Nat) + ..bits_8)] + (with_expansions [+' (template.spliced +)] + (case flag + (^.with_template [ ] + [ (`` (at ! each (|>> {(~~ (template.spliced ))}) ))]) + (+') + + _ (//.lifted (exception.except ..invalid_tag [(template.amount [+]) flag])))))])) (def: .public (or left right) (All (_ l r) (-> (Parser l) (Parser r) (Parser (Or l r)))) @@ -185,7 +187,7 @@ [[end binary]] {try.#Success})))))) -(template [ ] +(with_template [ ] [(`` (def: .public (Parser Binary) (do //.monad @@ -198,7 +200,7 @@ [64 binary_64 ..bits_64] ) -(template [ ] +(with_template [ ] [(`` (def: .public (Parser Text) (do //.monad @@ -213,7 +215,7 @@ (def: .public text ..utf8_64) -(template [ ] +(with_template [ ] [(def: .public ( valueP) (All (_ v) (-> (Parser v) (Parser (Sequence v)))) (do //.monad diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index e2b1b9c9e..017895abf 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -57,7 +57,7 @@ {.#Item next _} {try.#Success [tokens next]}))) -(template [ ] +(with_template [ ] [(with_expansions [ (these {try.#Failure (all text#composite "Cannot parse " (remaining_inputs tokens))})] (def: .public (Parser ) @@ -155,7 +155,7 @@ _ )))) -(template [ ] +(with_template [ ] [(def: .public ( p) (All (_ a) (-> (Parser a) (Parser a))) diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index 1887b387b..cf778566d 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -59,7 +59,7 @@ (exception.report "Value" (/.format value))) -(template [ ] +(with_template [ ] [(def: .public (Parser ) (do //.monad @@ -83,7 +83,7 @@ "Reference" (/.format reference) "Sample" (/.format sample))) -(template [ ] +(with_template [ ] [(def: .public ( test) (-> (Parser Bit)) (do //.monad diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux index 2fd9942fb..130b271ac 100644 --- a/stdlib/source/library/lux/control/parser/synthesis.lux +++ b/stdlib/source/library/lux/control/parser/synthesis.lux @@ -87,7 +87,7 @@ {.#End} true _ false)]})) -(template [ ] +(with_template [ ] [(`` (def: .public (Parser ) (.function (_ input) diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index c03a62dae..fbe318d12 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -118,7 +118,7 @@ _ (exception.except ..cannot_slice [])))) -(template [ ] +(with_template [ ] [(`` (def: .public ( parser) (All (_ a) (-> (Parser a) (Parser ))) (function (_ input) @@ -193,7 +193,7 @@ (n.<= top char')))] (in it))) -(template [ ] +(with_template [ ] [(def: .public (Parser Text) (..range (char ) (char ))) @@ -228,7 +228,7 @@ (..range! (char "a") (char "f")) (..range! (char "A") (char "F")))) -(template [] +(with_template [] [(exception: .public ( [options Text character Char]) (exception.report @@ -239,7 +239,7 @@ [character_should_not_be] ) -(template [ ] +(with_template [ ] [(def: .public ( options) (-> Text (Parser Text)) (function (_ [offset tape]) @@ -257,7 +257,7 @@ [none_of .not ..character_should_not_be] ) -(template [ ] +(with_template [ ] [(def: .public ( options) (-> Text (Parser Slice)) (function (_ [offset tape]) @@ -328,7 +328,7 @@ (open "right[0]") right] (in [left#basis ("lux i64 +" left#distance right#distance)]))) -(template [ ] +(with_template [ ] [(def: .public ( parser) (-> (Parser Text) (Parser Text)) (|> parser (at //.monad each /.together)))] @@ -337,7 +337,7 @@ [many //.many "many"] ) -(template [ ] +(with_template [ ] [(def: .public ( parser) (-> (Parser Slice) (Parser Slice)) (with_slices ( parser)))] @@ -346,7 +346,7 @@ [many! //.many "many"] ) -(template [ ] +(with_template [ ] [(def: .public ( amount parser) (-> Nat (Parser Text) (Parser Text)) (|> parser @@ -358,7 +358,7 @@ [at_least //.at_least "at least"] ) -(template [ ] +(with_template [ ] [(def: .public ( amount parser) (-> Nat (Parser Slice) (Parser Slice)) (with_slices diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux index b45e40449..751d370db 100644 --- a/stdlib/source/library/lux/control/parser/tree.lux +++ b/stdlib/source/library/lux/control/parser/tree.lux @@ -32,7 +32,7 @@ (exception: .public cannot_move_further) -(template [ ] +(with_template [ ] [(def: .public (All (_ t) (Parser t [])) (function (_ zipper) diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index 4b2e9cd90..b2dcbce6e 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -23,10 +23,11 @@ ["[0]" check]]]] ["[0]" //]) -(template: (|recursion_dummy|) - [{.#Primitive "" {.#End}}]) +(def: |recursion_dummy| + (template (|recursion_dummy|) + [{.#Primitive "" {.#End}}])) -(template [] +(with_template [] [(exception: .public ( [type Type]) (exception.report "Type" (%.type type)))] @@ -43,7 +44,7 @@ [not_tuple] ) -(template [] +(with_template [] [(exception: .public ( [expected Type actual Type]) (exception.report @@ -153,7 +154,7 @@ {try.#Success [[_ inputs'] output]} {try.#Success [[env inputs'] [g!var output]]})))) -(template [ ] +(with_template [ ] [(`` (def: .public ( poly) (All (_ a) (-> (Parser a) (Parser a))) (do //.monad @@ -232,7 +233,7 @@ (//.failure (exception.error ..not_application headT)) (..local {.#Item funcT paramsT} poly)))) -(template [ ] +(with_template [ ] [(def: .public ( expected) (-> Type (Parser Any)) (do //.monad diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index dd72e4d7a..372a217f3 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -65,7 +65,7 @@ (list))) (meta.failure (exception.error ..must_remember [deadline today message focus])))))) -(template [ ] +(with_template [ ] [(`` (def: .public (syntax (_ [deadline ..deadline message .text diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux index f01773f36..a41783bc9 100644 --- a/stdlib/source/library/lux/control/security/policy.lux +++ b/stdlib/source/library/lux/control/security/policy.lux @@ -76,7 +76,7 @@ (def: conjoint (|>> representation))) ) -(template [ ] +(with_template [ ] [(primitive: .public Any diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux index 2335c38a0..d39c1eff1 100644 --- a/stdlib/source/library/lux/data/binary.lux +++ b/stdlib/source/library/lux/data/binary.lux @@ -46,7 +46,7 @@ "Size" (%.nat size) "Index" (%.nat index))) -(template [ ] +(with_template [ ] [(def: .public ( index it) (-> Nat Binary (Try I64)) (if (n.< (/.size it) (|> index )) @@ -59,7 +59,7 @@ [bits_64 /.bits_64 (n.+ 7)] ) -(template [ ] +(with_template [ ] [(def: .public ( index value it) (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (/.size it) (|> index )) diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux index db83b05a9..da276ed5a 100644 --- a/stdlib/source/library/lux/data/bit.lux +++ b/stdlib/source/library/lux/data/bit.lux @@ -9,7 +9,7 @@ [control ["[0]" function]]]]) -(template [ ] +(with_template [ ] [(def: .public Bit #0) (def: .public Bit #1)] @@ -35,7 +35,7 @@ #0 2 #1 3))) -(template [ ] +(with_template [ ] [(implementation: .public (Monoid Bit) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 074e5e7f9..7d239d16a 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -139,7 +139,7 @@ (def: (each $ input) (!.each $ input))) -(template [ ] +(with_template [ ] [(def: .public ( ? it) (All (_ r w) (-> (Predicate r) (Predicate (Array' r w)))) diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux index e9b659d3a..1df1551e6 100644 --- a/stdlib/source/library/lux/data/collection/bits.lux +++ b/stdlib/source/library/lux/data/collection/bits.lux @@ -60,7 +60,7 @@ (|> bits (array.item idx) (maybe.else empty_chunk)) empty_chunk)) -(template [ ] +(with_template [ ] [(def: .public ( index input) (-> Nat Bits Bits) (let [[chunk_index bit_index] (n./% chunk_size index)] @@ -130,7 +130,7 @@ (again (-- size|output))) output)))))) -(template [ ] +(with_template [ ] [(def: .public ( param subject) (-> Bits Bits Bits) (case (n.max (array.size param) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index a4b122919..ef8f4f75d 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -638,7 +638,7 @@ (empty key_hash) kvs)) -(template [ ] +(with_template [ ] [(def: .public (All (_ k v) (-> (Dictionary k v) (List ))) (|>> (the #root) diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 76e5939be..00c1cc840 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -33,7 +33,7 @@ #left (Maybe (Node k v)) #right (Maybe (Node k v))])) -(template [ ] +(with_template [ ] [(def: ( key value left right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) [#color {} @@ -101,7 +101,7 @@ (again (the #left node)) (again (the #right node))))))))) -(template [ ] +(with_template [ ] [(def: .public ( dict) (All (_ k v) (-> (Dictionary k v) (Maybe v))) (case (the #root dict) @@ -136,7 +136,7 @@ (All (_ k v) (-> (Dictionary k v) Bit)) (|>> ..size (n.= 0))) -(template [ ] +(with_template [ ] [(def: ( self) (All (_ k v) (-> (Node k v) (Node k v))) (case (the #color self) @@ -259,7 +259,7 @@ {.#Some root} (let [reference (the #key root)] - (`` (cond (~~ (template [ ] + (`` (cond (~~ (with_template [ ] [( reference key) (let [side_root (the root) outcome (again side_root)] @@ -543,7 +543,7 @@ (empty order) list)) -(template [ ] +(with_template [ ] [(def: .public ( dict) (All (_ k v) (-> (Dictionary k v) (List ))) (loop (again [node (the #root dict)]) diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux index 1d7c385c2..4f91cfc6d 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux @@ -42,7 +42,7 @@ {.#Some v'} (value key properties')))) -(template [ ] +(with_template [ ] [(def: .public (All (_ a) (-> (PList a) (List ))) (list#each ))] diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index d29b0889a..64dbcb141 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -92,7 +92,7 @@ _ {.#None})) -(template [ ] +(with_template [ ] [(def: .public ( n xs) (All (_ a) (-> Nat (List a) (List a))) @@ -109,7 +109,7 @@ [after (after (-- n) xs') xs] ) -(template [ ] +(with_template [ ] [(def: .public ( predicate xs) (All (_ a) (-> (Predicate a) (List a) (List a))) @@ -261,7 +261,7 @@ (All (_ a) (-> (List a) Nat)) (mix (function (_ _ acc) (n.+ 1 acc)) 0 list)) -(template [ ] +(with_template [ ] [(def: .public ( predicate items) (All (_ a) (-> (Predicate a) (List a) Bit)) @@ -408,7 +408,7 @@ (or (at eq = x x') (member? eq xs' x)))) -(template [ ] +(with_template [ ] [(def: .public ( xs) (All (_ a) (-> (List a) (Maybe ))) (case xs diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 39bce01ad..b6bdf698a 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -59,7 +59,7 @@ Level 0) -(template [ ] +(with_template [ ] [(def: (-> Level Level) ( branching_exponent))] @@ -482,7 +482,7 @@ list.reversed (list#mix suffix ..empty))) -(template [ ] +(with_template [ ] [(def: .public (All (_ a) (-> (Predicate a) (Sequence a) Bit)) diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index ac422fd99..9141df9b2 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -66,7 +66,7 @@ (list#composite (list.repeated multiplicity elem) output)) {.#End}))) - (template [ ] + (with_template [ ] [(def: .public ( parameter subject) (All (_ a) (-> (Set a) (Set a) (Set a))) (abstraction (dictionary.composite_with (representation parameter) (representation subject))))] diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index 9e83655b9..296e0aadc 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -23,7 +23,7 @@ (All (_ a) (-> (Set a) a Bit)) (/.key? (representation set) elem)) - (template [ ] + (with_template [ ] [(def: .public (All (_ a) (-> (Set a) )) (|>> representation ))] diff --git a/stdlib/source/library/lux/data/collection/stream.lux b/stdlib/source/library/lux/data/collection/stream.lux index 0c8ba2d85..a005782b4 100644 --- a/stdlib/source/library/lux/data/collection/stream.lux +++ b/stdlib/source/library/lux/data/collection/stream.lux @@ -45,7 +45,7 @@ {.#Item head' tail'} (again head' tail'))]))) -(template [ ] +(with_template [ ] [(def: .public ( stream) (All (_ a) (-> (Stream a) )) (let [[head tail] (//.result stream)] @@ -62,7 +62,7 @@ 0 head _ (item (-- idx) tail)))) -(template [ ] +(with_template [ ] [(def: .public ( pred xs) (All (_ a) (-> (Stream a) (List a))) @@ -83,7 +83,7 @@ [first after Nat (n.= 0 pred) (-- pred) not] ) -(template [ ] +(with_template [ ] [(def: .public ( pred xs) (All (_ a) (-> (Stream a) [(List a) (Stream a)])) diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index 1a559f2ef..74b2c633b 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -29,7 +29,7 @@ (Tree @ t v))) branch))) - (template [ ] + (with_template [ ] [(def: .public (All (_ @ t v) (-> (Tree @ t v) )) (|>> representation (the )))] diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index 33bc9b1b6..861713b8c 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -116,7 +116,7 @@ _#rights}) _#parent)))))) -(template [ ] +(with_template [ ] [(def: .public ( zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (the #family zipper) @@ -215,7 +215,7 @@ {.#None} backward)})) -(template [ ] +(with_template [ ] [(def: .public ( zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case ( zipper) @@ -273,7 +273,7 @@ {.#Some})) (has #node next)))))) -(template [ ] +(with_template [ ] [(def: .public ( value zipper) (All (_ a) (-> a (Zipper a) (Maybe (Zipper a)))) (case (the #family zipper) diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index ebc8f8371..40424f426 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -316,7 +316,7 @@ #green (interpolated' greenE greenS) #blue (interpolated' blueE blueS)]))) -(template [ ] +(with_template [ ] [(def: .public ( ratio color) (-> Frac Color Color) (..interpolated ratio color))] @@ -325,7 +325,7 @@ [brighter ..white] ) -(template [ ] +(with_template [ ] [(def: .public ( ratio color) (-> Frac Color Color) (let [[hue saturation luminance] (hsl color)] @@ -346,7 +346,7 @@ +0.0 luminance]))) -(template [ <1> <2>] +(with_template [ <1> <2>] [(`` (def: .public ( color) (-> Color [Color Color Color]) (let [[hue saturation luminance] (hsl color)] @@ -363,7 +363,7 @@ [split_complement (|> +1.0 (f./ +5.0)) (|> +3.0 (f./ +5.0))] ) -(template [ <1> <2> <3>] +(with_template [ <1> <2> <3>] [(`` (def: .public ( color) (-> Color [Color Color Color Color]) (let [[hue saturation luminance] (hsb color)] diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux index 4e7ab9c1a..99fae8434 100644 --- a/stdlib/source/library/lux/data/color/named.lux +++ b/stdlib/source/library/lux/data/color/named.lux @@ -6,7 +6,7 @@ ["[0]" // (.only Color)]) ... https://developer.mozilla.org/en-US/docs/Web/CSS/color_value -(template [ ] +(with_template [ ] [(`` (def: .public Color (//.of_rgb [//.#red (hex ) diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 1f257ea7e..290996b4e 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -33,9 +33,10 @@ ["[0]" i64] ["[0]" frac]]]]]) -(template [ ] - [(template: ( ) - [( ( (.int ) (.int )))])] +(with_template [ ] + [(def: + (template ( ) + [( ( (.int ) (.int )))]))] [n#= "lux i64 =" .|>] [n#+ "lux i64 +" .nat] @@ -77,7 +78,7 @@ (All (_ a) (-> (Writer a) a Binary)) (..instance (writer value))) -(template [ ] +(with_template [ ] [(def: .public (Writer (I64 Any)) (function (_ value) @@ -96,7 +97,7 @@ (All (_ l r) (-> (Writer l) (Writer r) (Writer (Or l r)))) (function (_ altV) (case altV - (^.template [ ] + (^.with_template [ ] [{ caseV} (let [[caseS caseT] ( caseV)] [(.++ caseS) @@ -127,7 +128,7 @@ (Writer Bit) (|>> (pipe.case #0 0 #1 1) ..bits_8)) -(template [ ] +(with_template [ ] [(def: .public (Writer ) ..bits_64)] [nat Nat] @@ -151,7 +152,7 @@ offset binary)])])) -(template [ ] +(with_template [ ] [(def: .public (Writer Binary) (let [mask (..mask )] @@ -171,7 +172,7 @@ [binary_64 ..bits_64 .size_64 /.has_64!] ) -(template [ ] +(with_template [ ] [(def: .public (Writer Text) (|>> (at utf8.codec encoded) ))] @@ -184,7 +185,7 @@ (def: .public text ..utf8_64) -(template [ ] +(with_template [ ] [(def: .public ( valueW) (All (_ v) (-> (Writer v) (Writer (Sequence v)))) (function (_ value) @@ -241,7 +242,7 @@ quantified (..and (..list again) again)] (function (_ altV) (case altV - (^.template [ ] + (^.with_template [ ] [{ caseV} (let [[caseS caseT] ( caseV)] [(.++ caseS) @@ -275,7 +276,7 @@ (..and ..location (function (_ altV) (case altV - (^.template [ ] + (^.with_template [ ] [{ caseV} (let [[caseS caseT] ( caseV)] [(.++ caseS) diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux index 75013483b..3bb1f1da5 100644 --- a/stdlib/source/library/lux/data/format/css.lux +++ b/stdlib/source/library/lux/data/format/css.lux @@ -105,11 +105,12 @@ (text.interposed ..separator)) "}"))) - (template: (!composite
 )
-    [(abstraction
-      (format (representation 
)
-              ..separator
-              (representation )))])
+  (def: !composite
+    (template (!composite 
 )
+      [(abstraction
+        (format (representation 
)
+                ..separator
+                (representation )))]))
   
   (def: .public (and pre post)
     (All (_ kind) (-> (CSS kind) (CSS kind) (CSS kind)))
@@ -132,7 +133,7 @@
     (!composite (..rule selector style)
                 (..in_context combinator selector inner)))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public 
        (-> (Selector Any) Style (CSS Common) (CSS Common))
        (..dependent ))]
@@ -160,7 +161,7 @@
     (!composite (..rule selector style)
                 (..in_case combinator selector inner)))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public 
        (-> (Selector (Generic Any)) Style (CSS Common) (CSS Common))
        (..specialized ))]
diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux
index 3ee23b2b7..9361d2d4a 100644
--- a/stdlib/source/library/lux/data/format/css/property.lux
+++ b/stdlib/source/library/lux/data/format/css/property.lux
@@ -65,8 +65,8 @@
     (-> (Property Any) Text)
     (|>> representation))
 
-  (template [ + +]
-    [(`` (template [ ]
+  (with_template [ + +]
+    [(`` (with_template [ ]
            [(def: .public 
               (Property )
               (abstraction ))]
@@ -74,7 +74,7 @@
            (~~ (template.spliced +))))
 
      (with_expansions [ (template.spliced +)]
-       (template []
+       (with_template []
          [(`` (def: .public (~~ (text_symbol ))
                 (Property )
                 (abstraction )))]
diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux
index 7bd1c2c5d..ba0ee101f 100644
--- a/stdlib/source/library/lux/data/format/css/query.lux
+++ b/stdlib/source/library/lux/data/format/css/query.lux
@@ -32,7 +32,7 @@
     (-> Media Text)
     (|>> representation))
 
-  (template []
+  (with_template []
     [(`` (def: .public (~~ (text_symbol ))
            Media
            (abstraction )))]
@@ -50,7 +50,7 @@
     (-> Feature Text)
     (|>> representation))
 
-  (template [ ]
+  (with_template [ ]
     [(`` (def: .public ((~~ (text_symbol )) input)
            (-> (Value ) Feature)
            (abstraction (format "("  ": " (//value.value input) ")"))))]
@@ -110,7 +110,7 @@
     (-> Query Text)
     (|>> representation))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public 
        (-> Media Query)
        (|>> ..media (format ) abstraction))]
@@ -123,7 +123,7 @@
     (-> Feature Query)
     (|>> ..feature (format "not ") abstraction))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public ( left right)
        (-> Query Query Query)
        (abstraction (format (representation left)
diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux
index 9f62dc879..d982cfd55 100644
--- a/stdlib/source/library/lux/data/format/css/selector.lux
+++ b/stdlib/source/library/lux/data/format/css/selector.lux
@@ -23,7 +23,7 @@
 
 (primitive: .public (Generic brand) Any)
 
-(template [ ]
+(with_template [ ]
   [(primitive:  Any)
    (type: .public  (Generic ))]
 
@@ -50,7 +50,7 @@
     (-> Tag (Selector Cannot_Chain))
     (|>> abstraction))
 
-  (template [    ]
+  (with_template [    ]
     [(def: .public 
        (->  (Selector ))
        (|>>  (format ) abstraction))]
@@ -59,8 +59,8 @@
     [class Class "." Can_Chain //class.class]
     )
 
-  (template [  +]
-    [(`` (template [ ]
+  (with_template [  +]
+    [(`` (with_template [ ]
            [(def: .public ( right left)
               (-> (Selector ) (Selector ) (Selector Composite))
               (abstraction (format (representation left)
@@ -93,7 +93,7 @@
     (-> Attribute (Selector Can_Chain))
     (abstraction (format "[" attribute "]")))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public ( attribute value)
        (-> Attribute Text (Selector Can_Chain))
        (abstraction (format "[" attribute  value "]")))]
@@ -106,8 +106,8 @@
     ["*=" contains?]
     )
 
-  (template [ +]
-    [(`` (template [ ]
+  (with_template [ +]
+    [(`` (with_template [ ]
            [(def: .public 
               (Selector )
               (abstraction ))]
@@ -174,7 +174,7 @@
       (-> Nat Index)
       (|>> %.nat abstraction))
 
-    (template [ ]
+    (with_template [ ]
       [(def: .public  Index (abstraction ))]
       
       [odd "odd"]
@@ -194,7 +194,7 @@
                                (%.nat (.nat _#variable)))
                              (%.int _#constant)))))
     
-    (template [ ]
+    (with_template [ ]
       [(def: .public ( index)
          (-> Index (Selector Can_Chain))
          (|> (representation index)
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 743cd781b..61a8be4fb 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -33,28 +33,30 @@
   (syntax (_ [symbol .text])
     (in (list (code.local (text.replaced "-" "_" symbol))))))
 
-(template: (enumeration:    + +)
-  [(primitive: .public 
-     
+(def: enumeration:
+  (template (enumeration:    + +)
+    [(primitive: .public 
+       
 
-     (def: .public 
-       (->  )
-       (|>> representation))
+       (def: .public 
+         (->  )
+         (|>> representation))
 
-     (`` (template [ ]
-           [(def: .public   (abstraction ))]
+       (`` (with_template [ ]
+             [(def: .public   (abstraction ))]
 
-           (~~ (template.spliced +))
-           ))
+             (~~ (template.spliced +))
+             ))
 
-     (template.spliced +))])
+       (template.spliced +))]))
 
-(template: (multi:   )
-  [(def: .public ( pre post)
-     (-> (Value ) (Value ) (Value ))
-     (abstraction (format (representation pre)
-                          
-                          (representation post))))])
+(def: multi:
+  (template (multi:   )
+    [(def: .public ( pre post)
+       (-> (Value ) (Value ) (Value ))
+       (abstraction (format (representation pre)
+                            
+                            (representation post))))]))
 
 (def: (%number value)
   (Format Frac)
@@ -70,7 +72,7 @@
     (-> (Value Any) Text)
     (|>> representation))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public  Value (abstraction ))]
 
     [initial "initial"]
@@ -80,7 +82,7 @@
 
   (primitive: .public (Numeric kind) Any)
 
-  (template []
+  (with_template []
     [(with_expansions [' (template.symbol [ "'"])]
        (primitive: .public ' Any)
        (type: .public 
@@ -92,10 +94,10 @@
     [Percentage]
     )
 
-  (template [ + +]
+  (with_template [ + +]
     [(primitive: .public  Any)
 
-     (`` (template [ ]
+     (`` (with_template [ ]
            [(def: .public 
               (Value )
               (abstraction ))]
@@ -103,7 +105,7 @@
            (~~ (template.spliced +))))
 
      (with_expansions [ (template.spliced +)]
-       (template []
+       (with_template []
          [(`` (def: .public (~~ (..text_symbol ))
                 (Value )
                 (abstraction )))]
@@ -807,7 +809,7 @@
         (list#each %number)
         (..apply "cubic-bezier")))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public 
        (-> Nat (Value ))
        (|>> %.nat abstraction))]
@@ -840,7 +842,7 @@
                               "1.0"
                               (format "0" (%.rev _#alpha)))))))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public ( value)
        (-> Frac (Value Length))
        (abstraction (format (%number value) )))]
@@ -869,7 +871,7 @@
       (%.int value)
       (%.nat (.nat value))))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public ( value)
        (-> Int (Value Time))
        (abstraction (format (if (i.< +0 value)
@@ -949,7 +951,7 @@
       (-> Nat Angle)
       (abstraction (format (%.nat (n.% ..degree_limit value)) "deg")))
 
-    (template [ ]
+    (with_template [ ]
       [(def: .public 
          Angle
          (..degree ))]
@@ -960,7 +962,7 @@
       [270 to_left]
       )
 
-    (template [ ]
+    (with_template [ ]
       [(def: .public ( angle start next)
          (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image))
          (let [[now after] next]
@@ -988,8 +990,8 @@
     (abstraction (format (representation horizontal) ..slice_separator
                          (representation vertical))))
 
-  (template [ 
 +]
-    [(`` (template [ ]
+  (with_template [ 
 +]
+    [(`` (with_template [ ]
            [(def: .public 
               (->  (Value Filter))
               (|>> 
 (list) (..apply )))]
@@ -1032,7 +1034,7 @@
 
   (def: length_separator " ")
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public ( horizontal vertical)
        (-> (Value Length) (Value Length) (Value ))
        (abstraction (format (representation horizontal)
@@ -1067,7 +1069,7 @@
      [farthest_corner "farthest-corner"]]
     [])
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public ( shape extent location start next)
        (-> Shape (Maybe Extent) (Value Location)
            Stop (List/1 [(Maybe Hint) Stop])
@@ -1115,7 +1117,7 @@
 
   (def: .public (clip rectangle)
     (-> Rectangle (Value Clip))
-    (`` (..apply "rect" (list (~~ (template []
+    (`` (..apply "rect" (list (~~ (with_template []
                                     [(representation (the  rectangle))]
 
                                     [#top] [#right] [#bottom] [#left]))))))
@@ -1255,7 +1257,7 @@
         (list#each %number)
         (..apply "matrix3d")))
 
-  (template [   ]
+  (with_template [   ]
     [(`` (def: .public ( [(~~ (template.spliced ))])
            (-> [(~~ (template.spliced ))] (Value Transform))
            (|> (list (~~ (template.spliced )))
@@ -1277,7 +1279,7 @@
     [perspective "perspective" [Frac] [value]]
     )
 
-  (template [   ]
+  (with_template [   ]
     [(`` (def: .public ( [(~~ (template.spliced ))])
            (-> [(~~ (template.spliced ))] (Value Transform))
            (|> (list (~~ (template.spliced )))
@@ -1327,7 +1329,7 @@
   (multi: multi_content Content " ")
 
   ... https://developer.mozilla.org/en-US/docs/Web/CSS/calc()
-  (template [ ]
+  (with_template [ ]
     [(def: .public ( parameter subject)
        (.All (_ kind)
          (-> (Value ) (Value (Numeric kind))
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 8a3a964c1..9d7821328 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -82,7 +82,7 @@
 (primitive: .public (HTML brand)
   Text
 
-  (.template [ ]
+  (.with_template [ ]
     [(primitive:  Any)
      (type: .public  (HTML ))]
 
@@ -100,11 +100,11 @@
     [Document Document']
     )
 
-  (.template [  +]
+  (.with_template [  +]
     [(primitive: ( brand) Any)
      (type: .public  (HTML ( Any)))
 
-     (`` (.template [ ]
+     (`` (.with_template [ ]
            [(primitive:  Any)
             (type: .public  (HTML ( )))]
 
@@ -159,7 +159,7 @@
              content
              (..close tag))))
 
-  (.template [  ]
+  (.with_template [  ]
     [(def: .public 
        (-> Attributes )
        (..simple ))]
@@ -199,7 +199,7 @@
     (|>> ..safe
          abstraction))
 
-  (.template [  ]
+  (.with_template [  ]
     [(def: .public 
        Element
        (..simple  (list)))
@@ -271,7 +271,7 @@
      {#Circle Circle}
      {#Polygon Polygon}))
 
-  (.template [   ]
+  (.with_template [   ]
     [(def: ( attributes shape)
        (-> Attributes  (HTML Any))
        (..simple "area" (partial_list ["shape" ]
@@ -307,7 +307,7 @@
            (..tag "map" attributes
                   (list#mix (function.flipped ..and) head tail)))))
 
-  (.template [  ]
+  (.with_template [  ]
     [(def: .public 
        (-> Attributes )
        (..empty ))]
@@ -319,7 +319,7 @@
     [track "track" Track]
     )
 
-  (.template [ ]
+  (.with_template [ ]
     [(def: .public ( attributes media on_unsupported)
        (-> Attributes Media (Maybe Content) Element)
        (..tag  attributes
@@ -343,7 +343,7 @@
     (-> ID Input)
     (|>> ["for"] list (..empty "label")))
 
-  (.template [   ]
+  (.with_template [   ]
     [(def: .public ( description attributes content)
        (-> (Maybe Content) Attributes  )
        (..tag  attributes
@@ -361,7 +361,7 @@
     [figure "figure" "figcaption" Element]
     )
 
-  (.template [  ]
+  (.with_template [  ]
     [(def: .public ( attributes content)
        (-> Attributes (Maybe Content) )
        (|> content
@@ -375,7 +375,7 @@
   (type: .public Phrase
     (-> Attributes Content Element))
 
-  (.template [ ]
+  (.with_template [ ]
     [(def: .public 
        Phrase
        (..tag ))]
@@ -432,7 +432,7 @@
   (type: .public Composite
     (-> Attributes Element Element))
 
-  (.template [ ]
+  (.with_template [ ]
     [(def: .public 
        Composite
        (..tag ))]
@@ -450,7 +450,7 @@
     [span "span"]
     )
 
-  (.template [  ]
+  (.with_template [  ]
     [(def: 
        (->  (HTML Any))
        (..tag  (list)))]
@@ -475,7 +475,7 @@
 
   (def: .public p ..paragraph)
 
-  (.template [   ]
+  (.with_template [   ]
     [(def: .public 
        (-> Attributes  )
        (..tag ))]
@@ -494,7 +494,7 @@
     [object "object" Parameter Element]
     )
 
-  (.template [   ]
+  (.with_template [   ]
     [(def: .public 
        (->  )
        (..tag  (list)))]
@@ -508,7 +508,7 @@
     [body "body" Element Body]
     )
 
-  (.template [   ]
+  (.with_template [   ]
     [(def: 
        (->  )
        (..tag  (list)))]
@@ -555,7 +555,7 @@
       (..tag "table" attributes
              content)))
 
-  (.template [ ]
+  (.with_template [ ]
     [(def: .public 
        (-> Head Body Document)
        (let [doc_type ]
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 6e358ec80..4f95615ed 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -31,7 +31,7 @@
      ["n" nat]
      ["f" frac (.open: "[1]#[0]" decimal)]]]]])
 
-(template [ ]
+(with_template [ ]
   [(type: .public 
      )]
 
@@ -51,7 +51,7 @@
      {#Array   (Sequence JSON)}
      {#Object  (Dictionary String JSON)})))
 
-(template [ ]
+(with_template [ ]
   [(type: .public 
      )]
 
@@ -101,7 +101,7 @@
     {#Null' _}
     (` {..#Null})
     
-    (^.template [  ]
+    (^.with_template [  ]
       [{ value}
        (` { (~ ( value))})])
     ([code.bit  ..#Boolean' ..#Boolean]
@@ -158,7 +158,7 @@
     _
     {try.#Failure (all text#composite "Cannot set field '" key "' on a non-object.")}))
 
-(template [  ]
+(with_template [  ]
   [(def: .public ( key json)
      (-> Text JSON (Try ))
      (case (field key json)
@@ -186,7 +186,7 @@
       [{#Null} {#Null}]
       #1
 
-      (^.template [ ]
+      (^.with_template [ ]
         [[{ x'} { y'}]
          (at  = x' y')])
       ([#Boolean bit.equivalence]
@@ -252,7 +252,7 @@
   (|>> (text.replaced text.double_quote ..escaped_dq)
        (text.enclosed [text.double_quote text.double_quote])))
 
-(template [ ]
+(with_template [ ]
   [(def: 
      Text
      )]
@@ -292,7 +292,7 @@
 (def: .public (format json)
   (-> JSON Text)
   (case json
-    (^.template [ ]
+    (^.with_template [ ]
       [{ value}
        ( value)])
     ([#Null    ..null_format]
@@ -324,7 +324,7 @@
     [_ (.this "null")]
     (in [])))
 
-(template [  ]
+(with_template [  ]
   [(def: 
      (Parser Boolean)
      (do <>.monad
@@ -405,7 +405,7 @@
      value json_parser]
     (in [key value])))
 
-(template [     ]
+(with_template [     ]
   [(def: ( json_parser)
      (-> (Parser JSON) (Parser ))
      (do <>.monad
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index 4982a2b63..1ebea0782 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -48,7 +48,7 @@
   (def: blank_line
     (format text.new_line text.new_line))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public ( content)
        (-> Text (Markdown Block))
        (abstraction (format  " " (..safe content) ..blank_line)))]
@@ -73,7 +73,7 @@
     (Markdown Span)
     (abstraction (format "  " text.new_line)))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public 
        (-> (Markdown Span) (Markdown Span))
        (|>> representation
@@ -176,7 +176,7 @@
   (type: .public Email
     Text)
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public 
        (->  (Markdown Span))
        (|>> (text.enclosed ["<" ">"]) abstraction))]
@@ -185,7 +185,7 @@
     [email Email]
     )
 
-  (template [  ]
+  (with_template [  ]
     [(def: .public ( pre post)
        (-> (Markdown ) (Markdown ) (Markdown ))
        (abstraction (format (representation pre)  (representation post))))]
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index 42088c430..c3644dcee 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -61,7 +61,7 @@
 (def: small_size Size 6)
 (def: big_size Size 11)
 
-(template [  
+(with_template [  
                
            ]
   [(def: .public 
@@ -249,7 +249,7 @@
                        _
                        (binary!.slice 0 (++ end) string))))))))
 
-(template [        ]
+(with_template [        ]
   [(primitive: .public 
      
 
@@ -415,7 +415,7 @@
                                      [(char "5") directory]
                                      [(char "6") fifo]
                                      [(char "7") contiguous])]
-    (template [ ]
+    (with_template [ ]
       [(def: 
          Link_Flag
          (abstraction ))]
@@ -432,7 +432,7 @@
       (do <>.monad
         [it .bits_8]
         (case (.nat it)
-          (^.template [ ]
+          (^.with_template [ ]
             [(pattern )
              (in )])
           ()
@@ -483,7 +483,7 @@
                                      ["1000" save_text]
                                      ["2000" set_group_id_on_execution]
                                      ["4000" set_user_id_on_execution])]
-    (template [ ]
+    (with_template [ ]
       [(def: .public 
          Mode
          (abstraction (number.oct )))]
diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux
index 669f58e4f..c57ec6cfc 100644
--- a/stdlib/source/library/lux/data/product.lux
+++ b/stdlib/source/library/lux/data/product.lux
@@ -5,7 +5,7 @@
     [equivalence (.only Equivalence)]
     [hash (.only Hash)]]]])
 
-(template []
+(with_template []
   [(def: .public ( [left right])
      (All (_ left right)
        (-> [left right] ))
diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux
index a021449c0..00dddc0e6 100644
--- a/stdlib/source/library/lux/data/sum.lux
+++ b/stdlib/source/library/lux/data/sum.lux
@@ -5,7 +5,7 @@
     [equivalence (.only Equivalence)]
     [hash (.only Hash)]]]])
 
-(template [ ]
+(with_template [ ]
   [(def: .public ( value)
      (All (_ left right)
        (->  (Or left right)))
@@ -32,7 +32,7 @@
       {0 #0 l} {0 #0 (on_left l)}
       {0 #1 r} {0 #1 (on_right r)})))
 
-(template [  ]
+(with_template [  ]
   [(def: .public ( items)
      (All (_ a b) (-> (List (Or a b)) (List )))
      (case items
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 8e9eccac7..91c9cedf6 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -30,7 +30,7 @@
   (-> Char Text)
   (|>> .int "lux i64 char"))
 
-(template [  ]
+(with_template [  ]
   [(def: .public  (..of_char ))
    (def: .public  )]
 
@@ -337,7 +337,7 @@
 
 (def: .public (space? char)
   (-> Char Bit)
-  (with_expansions [ (template []
+  (with_expansions [ (with_template []
                                 [(pattern (.char (~~ (static ))))]
 
                                 [..tab]
diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux
index 6eaf948d0..da140a7e1 100644
--- a/stdlib/source/library/lux/data/text/encoding.lux
+++ b/stdlib/source/library/lux/data/text/encoding.lux
@@ -10,7 +10,7 @@
 (primitive: .public Encoding
   Text
 
-  (template [ ]
+  (with_template [ ]
     [(`` (def: .public 
            Encoding
            (abstraction )))]
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index 7b9caa349..608737079 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -22,7 +22,7 @@
 
 (def: sigil "\")
 
-(template [ ]
+(with_template [ ]
   [(def: 
      (|>  (//.char 0) maybe.trusted))]
 
@@ -30,7 +30,7 @@
   [\u_sigil "u"]
   )
 
-(template [  ]
+(with_template [  ]
   [(def: 
      (|>  (//.char 0) maybe.trusted))
    
@@ -49,7 +49,7 @@
   [..sigil \\_sigil escaped_\\]
   )
 
-(template [ ]
+(with_template [ ]
   [(def: 
      (|>  (//.char 0) maybe.trusted))]
 
@@ -73,7 +73,7 @@
   (or (n.< ..ascii_bottom char)
       (n.> ..ascii_top char)
       (case char
-        (^.template []
+        (^.with_template []
           [(pattern (static ))
            true])
         ([..\0] [..\a] [..\b] [..\t]
@@ -118,7 +118,7 @@
                 limit ("lux text size" text)])
     (if (n.< limit offset)
       (case ("lux text char" offset current)
-        (^.template [ ]
+        (^.with_template [ ]
           [(pattern (static ))
            (let [[previous' current' limit'] (ascii_escaped  offset limit previous current)]
              (again 0 previous' current' limit'))])
@@ -206,7 +206,7 @@
         (let [@sigil (++ offset)]
           (if (n.< limit @sigil)
             (case ("lux text char" @sigil current)
-              (^.template [ ]
+              (^.with_template [ ]
                 [(pattern (static ))
                  (let [[previous' current' limit'] (..ascii_un_escaped  offset previous current limit)]
                    (again 0 previous' current' limit'))])
diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux
index 7c5483112..ce3642c9e 100644
--- a/stdlib/source/library/lux/data/text/format.lux
+++ b/stdlib/source/library/lux/data/text/format.lux
@@ -52,7 +52,7 @@
   (syntax (_ [fragments (<>.many .any)])
     (in (.list (` (all "lux text concat" (~+ fragments)))))))
 
-(template [  ]
+(with_template [  ]
   [(def: .public 
      (Format )
      )]
@@ -81,8 +81,8 @@
   [json     json.JSON         (at json.codec encoded)]
   )
 
-(template [ ,]
-  [(`` (template [ ]
+(with_template [ ,]
+  [(`` (with_template [ ]
          [(def: .public 
             (Format )
             (at  encoded))]
diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux
index e016e68bb..92398a955 100644
--- a/stdlib/source/library/lux/data/text/unicode/block.lux
+++ b/stdlib/source/library/lux/data/text/unicode/block.lux
@@ -38,7 +38,7 @@
     (-> Char Nat Block)
     (abstraction (interval.between n.enum start (n.+ additional start))))
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public 
        (-> Block Char)
        (|>> representation (the )))]
@@ -73,7 +73,7 @@
     (i64.or (i64.left_shifted 32 (..start value))
             (..end value))))
 
-(template [  ]
+(with_template [  ]
   [(def: .public 
      Block
      (let [start (hex )
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux
index 92f5d26c6..f7211bc8a 100644
--- a/stdlib/source/library/lux/data/text/unicode/set.lux
+++ b/stdlib/source/library/lux/data/text/unicode/set.lux
@@ -233,7 +233,7 @@
              (set.of_list //block.hash (tree.tags (representation subject))))))
   )
 
-(template [ ]
+(with_template [ ]
   [(def: .public 
      Set
      (..set ))]
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 64f1cb80f..942db335e 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -146,7 +146,7 @@
 (def: .public (inspection value)
   Inspector
   (with_expansions [ (let [object (as java/lang/Object value)]
-                            (`` (<| (~~ (template [ ]
+                            (`` (<| (~~ (with_template [ ]
                                           [(case (ffi.as  object)
                                              {.#Some value}
                                              (`` (|> value (~~ (template.spliced ))))
@@ -184,7 +184,7 @@
 
          @.js
          (case (ffi.type_of value)
-           (^.template [ ]
+           (^.with_template [ ]
              [
               (`` (|> value (~~ (template.spliced ))))])
            (["boolean" [(as .Bit) %.bit]]
@@ -219,7 +219,7 @@
 
          @.python
          (case (..str (..type value))
-           (^.template [  ]
+           (^.with_template [  ]
              [(^.or  )
               (`` (|> value (~~ (template.spliced ))))])
            (["" "" [(as .Bit) %.bit]]
@@ -251,7 +251,7 @@
 
          @.lua
          (case (..type value)
-           (^.template [ ]
+           (^.with_template [ ]
              [
               (`` (|> value (~~ (template.spliced ))))])
            (["boolean" [(as .Bit) %.bit]]
@@ -292,7 +292,7 @@
                              (as ..Object)
                              Object::to_s)]]
            (let [value_class (class_of value)]
-             (`` (cond (~~ (template [  ]
+             (`` (cond (~~ (with_template [  ]
                              [(same? (class_of ) value_class)
                               (|> value (as ) )]
 
@@ -324,7 +324,7 @@
 
          @.php
          (case (..gettype value)
-           (^.template [ ]
+           (^.with_template [ ]
              [
               (`` (|> value (~~ (template.spliced ))))])
            (["boolean" [(as .Bit) %.bit]]
@@ -350,7 +350,7 @@
            (..strval value))
 
          @.scheme
-         (`` (cond (~~ (template [ ]
+         (`` (cond (~~ (with_template [ ]
                          [( value)
                           (`` (|> value (~~ (template.spliced ))))]
 
@@ -394,7 +394,7 @@
              [_ (.exactly Any)]
              (in (function.constant "[]")))
            
-           (~~ (template [ ]
+           (~~ (with_template [ ]
                  [(do <>.monad
                     [_ (.sub )]
                     (in (|>> (as ) )))]
@@ -410,7 +410,7 @@
 (def: (special_representation representation)
   (-> (Parser Representation) (Parser Representation))
   (`` (all <>.either
-           (~~ (template [ ]
+           (~~ (with_template [ ]
                  [(do <>.monad
                     [_ (.sub )]
                     (in (|>> (as ) )))]
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index 8a67b4805..7460eb2fd 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -35,8 +35,9 @@
       [lux
        ["[0]" syntax]]]]]]])
 
-(template: (|recursion_dummy|)
-  [{.#Primitive "" {.#End}}])
+(def: |recursion_dummy|
+  (template (_)
+    [{.#Primitive "" {.#End}}]))
 
 (type: Fragment
   (Variant
@@ -51,7 +52,7 @@
 (def: (reference_column code)
   (-> Code Nat)
   (case code
-    (^.template []
+    (^.with_template []
       [[[_ _ column] { _}]
        column])
     ([.#Bit]
@@ -62,7 +63,7 @@
      [.#Text]
      [.#Symbol])
 
-    (^.template []
+    (^.with_template []
       [[[_ _ column] { members}]
        (|> members
            (list#each reference_column)
@@ -101,7 +102,7 @@
        (format (padding reference_column old_location new_location)
                documentation)])
     
-    (^.template [ ]
+    (^.with_template [ ]
       [[new_location { value}]
        (let [documentation (`` (|> value (~~ (template.spliced ))))]
          [(revised .#column (n.+ (text.size documentation)) new_location)
@@ -114,7 +115,7 @@
      [.#Frac [%.frac]]
      [.#Text [%.text]])
 
-    (^.template [|<| |>| ]
+    (^.with_template [|<| |>| ]
       [[group_location { members}]
        (let [[group_location' members_documentation] (list#mix (function (_ part [last_location text_accum])
                                                                  (let [[member_location member_documentation] (code_documentation expected_module last_location reference_column part)]
@@ -170,7 +171,7 @@
   (stream.iterations (product.forked ++ parameter_type_name)
                      0))
 
-(template [ ]
+(with_template [ ]
   [(def: ( id)
      (-> Nat Bit)
      ( id))]
@@ -251,13 +252,13 @@
     {.#Parameter idx}
     (parameter_name [type_function_name (list)] level idx)
 
-    (^.template [ 
 ]
+    (^.with_template [ 
 ]
       [{ id}
        (format 
 (%.nat id) )])
     ([.#Var "⌈" "⌋"]
      [.#Ex  "⟨" "⟩"])
 
-    (^.template [  ]
+    (^.with_template [  ]
       [{ _}
        (let [[level' body] ( type)
              args (level_parameters level level')
@@ -382,13 +383,13 @@
       {.#Parameter idx}
       (parameter_name type_function_info level idx)
 
-      (^.template [ 
]
+      (^.with_template [ 
]
         [{ id}
          (format 
 (%.nat id))])
       ([.#Var "-"]
        [.#Ex  "+"])
 
-      (^.template [  ]
+      (^.with_template [  ]
         [{ _}
          (let [[level' body] ( type)
                args (level_parameters (n.- arity level) level')
diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux
index fd4781f84..ffe7a4a78 100644
--- a/stdlib/source/library/lux/extension.lux
+++ b/stdlib/source/library/lux/extension.lux
@@ -36,7 +36,7 @@
                  .local
                  (.tuple (<>.some .any)))))
 
-(template [     ]
+(with_template [     ]
   [(def: .public 
      (syntax (_ [[name extension phase archive inputs] (..declaration (` ))
                  body .any])
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index ebf0a980e..dfc01098b 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -53,7 +53,7 @@
     (-> (Type (<| Return' Value' category)) Text))
   (|>> jvm.reflection reflection.reflection))
 
-(template [ ]
+(with_template [ ]
   [(`` (def: .public 
          .Type
          {.#Primitive  {.#End}}))]
@@ -69,7 +69,7 @@
   [String    "java.lang.String"]
   )
 
-(template [ ]
+(with_template [ ]
   [(`` (def: .public 
          .Type
          {.#Primitive (reflection.reflection ) {.#End}}))]
@@ -110,7 +110,7 @@
             [jvm.char    box.char])
       (dictionary.of_list jvm.hash)))
 
-(template [ 
 ]
+(with_template [ 
 ]
   [(def: ( unboxed boxed raw)
      (-> (Type Value) Text Code Code)
      (let [unboxed (..reflection unboxed)]
@@ -123,14 +123,15 @@
   [box unboxed boxed]
   )
 
-(template [   ]
-  [(template: .public ( value)
-     [(|> value
-          (.is )
-          "jvm object cast"
-          
-          "jvm object cast"
-          (.is ))])]
+(with_template [   ]
+  [(def: .public 
+     (template ( value)
+       [(|> value
+            (.is )
+            "jvm object cast"
+            
+            "jvm object cast"
+            (.is ))]))]
 
   [byte_to_long    "jvm conversion byte-to-long"    ..Byte      ..Long]
 
@@ -163,9 +164,10 @@
   [char_to_long    "jvm conversion char-to-long"    ..Character ..Long]
   )
 
-(template [   <0> <1>]
-  [(template: .public ( value)
-     [(|> value <0> <1>)])]
+(with_template [   <0> <1>]
+  [(def: .public 
+     (template ( value)
+       [(|> value <0> <1>)]))]
 
   [long_to_char ..Long ..Character ..long_to_int ..int_to_char]
   [byte_to_int ..Byte ..Integer ..byte_to_long ..long_to_int]
@@ -362,7 +364,7 @@
 (def: (parameter_type value_type type)
   (-> (-> (Type Value) Code)
       (-> (Type Parameter) Code))
-  (`` (<| (~~ (template [  ]
+  (`` (<| (~~ (with_template [  ]
                 [(case ( type)
                    {.#Some }
                    
@@ -389,7 +391,7 @@
 
 (def: (value_type mode type)
   (-> Primitive_Mode (Type Value) Code)
-  (`` (<| (~~ (template [  ]
+  (`` (<| (~~ (with_template [  ]
                 [(case ( type)
                    {.#Some }
                    
@@ -434,7 +436,7 @@
 (def: (replaced f input)
   (-> (-> Code Code) Code Code)
   (case (f input)
-    (^.template []
+    (^.with_template []
       [[meta { parts}]
        [meta { (list#each (replaced f) parts)}]])
     ([.#Form]
@@ -491,7 +493,7 @@
                     (list.zipped_2 (list#each product.right arguments))
                     (list#each ..decorate_input))))))))
 
-(template [ ]
+(with_template [ ]
   [(def: ( class_vars class_name type_vars method_name arguments self_name)
      (-> (List (Type Var)) Text (List (Type Var)) Text (List Argument) Text (Parser Code))
      (do <>.monad
@@ -607,7 +609,7 @@
     [_ (.this (' ?))]
     (in jvm.wildcard)))
 
-(template [  ]
+(with_template [  ]
   [(def: 
      (-> (Parser (Type Class)) (Parser (Type Parameter)))
      (|>> (<>.after (.this (' )))
@@ -1022,7 +1024,7 @@
   (-> Annotation Code)
   (` ((~ (code.text name)) (~+ (list#each annotation_parameter$ params)))))
 
-(template [ ]
+(with_template [ ]
   [(def: 
      (-> (Type ) Code)
      (|>> ..signature code.text))]
@@ -1388,7 +1390,7 @@
     _
     return_term))
 
-(template [  ]
+(with_template [  ]
   [(def: ( member return_term)
      (-> Import_Member_Declaration Code Code)
      (case member
@@ -1404,7 +1406,7 @@
   [with_return_io  #import_member_io?  (` ((~! io.io) (~ return_term)))]
   )
 
-(template [   ]
+(with_template [   ]
   [(def: ( mode [unboxed raw])
      (-> Primitive_Mode [(Type Value) Code] Code)
      (let [[unboxed refined post] (.is [(Type Value) Code (List Code)]
@@ -1414,7 +1416,7 @@
                                          
                                          {#AutoPrM}
                                          (with_expansions [' (template.spliced )
-                                                            (template [ 
 ]
+                                                            (with_template [ 
 ]
                                                                           [(at jvm.equivalence =  unboxed)
                                                                            (with_expansions [' (template.spliced )]
                                                                              [
@@ -1692,7 +1694,7 @@
                         (.as (.Primitive (~ (code.text box.long))))
                         "jvm object cast"
                         "jvm conversion long-to-int"))]
-      (`` (cond (~~ (template [ ]
+      (`` (cond (~~ (with_template [ ]
                       [(at jvm.equivalence =  type)
                        (in (list (` ( (~ g!size)))))]
 
@@ -1720,7 +1722,7 @@
       (at meta.monad in $Object)
       (case type
         {.#Primitive name params}
-        (`` (cond (~~ (template []
+        (`` (cond (~~ (with_template []
                         [(text#= (..reflection ) name)
                          (case params
                            {.#End}
@@ -1738,7 +1740,7 @@
                         [jvm.double]
                         [jvm.char]))
 
-                  (~~ (template []
+                  (~~ (with_template []
                         [(text#= (..reflection (jvm.array )) name)
                          (case params
                            {.#End}
@@ -1820,7 +1822,7 @@
         [array_type (meta.type array_name)
          context meta.type_context
          array_jvm_type (lux_type->jvm_type context array_type)
-         .let [g!extension (code.text (`` (cond (~~ (template [ ]
+         .let [g!extension (code.text (`` (cond (~~ (with_template [ ]
                                                       [(at jvm.equivalence =
                                                            (jvm.array )
                                                            array_jvm_type)
@@ -1862,7 +1864,7 @@
                              (.as (.Primitive (~ (code.text box.long))))
                              "jvm object cast"
                              "jvm conversion long-to-int"))]]
-        (`` (cond (~~ (template [  ]
+        (`` (cond (~~ (with_template [  ]
                         [(at jvm.equivalence =
                              (jvm.array )
                              array_jvm_type)
@@ -1902,7 +1904,7 @@
                              (.as (.Primitive (~ (code.text box.long))))
                              "jvm object cast"
                              "jvm conversion long-to-int"))]]
-        (`` (cond (~~ (template [  ]
+        (`` (cond (~~ (with_template [  ]
                         [(at jvm.equivalence =
                              (jvm.array )
                              array_jvm_type)
@@ -1953,12 +1955,14 @@
       _
       (meta.failure (exception.error ..cannot_cast_to_non_object [type])))))
 
-(template [   ]
-  [(template: .public ( it)
-     [(|> it (.is ) (.as ))])
+(with_template [   ]
+  [(def: .public 
+     (template ( it)
+       [(|> it (.is ) (.as ))]))
 
-   (template: .public ( it)
-     [(|> it (.is ) (.as ))])]
+   (def: .public 
+     (template ( it)
+       [(|> it (.is ) (.as ))]))]
 
   [as_boolean .Bit ..Boolean of_boolean]
   [as_long .Int ..Long of_long]
@@ -1966,12 +1970,14 @@
   [as_string .Text ..String of_string]
   )
 
-(template [  <$>  <$'>  ]
-  [(template: .public ( it)
-     [(|> it (.is ) (.as ) <$> (.is ))])
+(with_template [  <$>  <$'>  ]
+  [(def: .public 
+     (template ( it)
+       [(|> it (.is ) (.as ) <$> (.is ))]))
 
-   (template: .public ( it)
-     [(|> it (.is ) <$'> (.is ) (.as ))])]
+   (def: .public 
+     (template ( it)
+       [(|> it (.is ) <$'> (.is ) (.as ))]))]
 
   [as_byte .Int ..long_to_byte ..Long ..byte_to_long ..Byte of_byte]
   [as_short .Int ..long_to_short ..Long ..short_to_long ..Short of_short]
diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux
index 25d65c691..e9843701d 100644
--- a/stdlib/source/library/lux/ffi.lux
+++ b/stdlib/source/library/lux/ffi.lux
@@ -64,7 +64,7 @@
                                                   [Table])
                                      @.ruby (these [Nil]))
                      ]
-    (template []
+    (with_template []
       [(with_expansions [ (template.symbol [ "'"])]
          (primitive: 
            Any
@@ -84,7 +84,7 @@
                                      @.ruby (these [Integer Int]
                                                    [Float   Frac]))
                      ]
-    (template [ ]
+    (with_template [ ]
       [(type: .public 
          )]
 
@@ -118,7 +118,7 @@
       #alias Alias
       #anonymous a]))
 
-  (template [ ]
+  (with_template [ ]
     [(def: 
        (All (_ a) (-> (Parser a) (Parser (Named a))))
        (|>> (all <>.and
@@ -262,8 +262,8 @@
       (` (.Maybe (~ (the #mandatory it))))
       (the #mandatory it)))
 
-  (`` (template [ 
-                  ]
+  (`` (with_template [ 
+                       ]
         [(def: .public ( _)
            (-> Any Nothing)
            (as_expected ()))
@@ -622,8 +622,9 @@
                              (.function ((~ (code.local self)) [(~+ (list#each product.left inputs))])
                                (~ term)))))))))
 
-  (for @.js (these (template: .public (type_of object)
-                     [("js type-of" object)])
+  (for @.js (these (def: .public type_of
+                     (template (type_of object)
+                       [("js type-of" object)]))
 
                    (def: .public global
                      (syntax (_ [type .any
@@ -651,15 +652,16 @@
                                                   (..global (~ type) [(~ (code.local (%.format head "." next)))
                                                                       (~+ (list#each code.local tail))]))))))))))))
 
-                   (template: (!defined? )
-                     [(.case (..global Any )
-                        {.#None}
-                        .false
+                   (def: !defined?
+                     (template (_ )
+                       [(.case (..global Any )
+                          {.#None}
+                          .false
 
-                        {.#Some _}
-                        .true)])
+                          {.#Some _}
+                          .true)]))
 
-                   (template [ ]
+                   (with_template [ ]
                      [(def: .public 
                         Bit
                         (!defined? ))]
@@ -690,36 +692,40 @@
                    (with_expansions [ (..extension_name)
                                       (..extension_name)
                                       (..extension_name)]
-                     (these (template: (extension_analysis  )
-                              [{5 #1 [ ]}])
-
-                            (template: (text_analysis )
-                              [{0 #0 {5 #1 }}])
-
-                            (template: (analysis     )
-                              [("lux def analysis" 
-                                (.function (_ name phase archive inputs)
-                                  (.function (_ state)
-                                    (let [ [name phase archive state]]
-                                      (case (.result  inputs)
-                                        {try.#Failure error}
-                                        {try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
-                                                                text.\n error)}
-
-                                        {try.#Success }
-                                        )))))])
-
-                            (template: (generation    )
-                              [("lux def generation" 
-                                (.function (_ name phase archive inputs)
-                                  (.function (_ state)
-                                    (let [ [name phase archive state]]
-                                      (case inputs
-                                        (pattern )
-                                        
-
-                                        _
-                                        {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))])
+                     (these (def: extension_analysis
+                              (template (_  )
+                                [{5 #1 [ ]}]))
+
+                            (def: text_analysis
+                              (template (_ )
+                                [{0 #0 {5 #1 }}]))
+
+                            (def: analysis
+                              (template (_     )
+                                [("lux def analysis" 
+                                  (.function (_ name phase archive inputs)
+                                    (.function (_ state)
+                                      (let [ [name phase archive state]]
+                                        (case (.result  inputs)
+                                          {try.#Failure error}
+                                          {try.#Failure (%.format "Invalid inputs for extension: " (%.text name)
+                                                                  text.\n error)}
+
+                                          {try.#Success }
+                                          )))))]))
+
+                            (def: generation
+                              (template (_    )
+                                [("lux def generation" 
+                                  (.function (_ name phase archive inputs)
+                                    (.function (_ state)
+                                      (let [ [name phase archive state]]
+                                        (case inputs
+                                          (pattern )
+                                          
+
+                                          _
+                                          {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))]))
 
                             (analysis 
                                       [name phase archive state]
@@ -732,8 +738,9 @@
                                         (list)
                                         {try.#Success [state js.undefined]})
 
-                            (template: .public (undefined)
-                              [(.is ..Undefined ())])
+                            (def: .public undefined
+                              (template (undefined)
+                                [(.is ..Undefined ())]))
 
                             (analysis 
                                       [name phase archive state]
@@ -750,8 +757,9 @@
                                           [[state it] (phase archive it state)]
                                           (in [state (js.= js.undefined it)])))
 
-                            (template: .public (undefined? )
-                              [(.as .Bit (.is .Any ( )))])
+                            (def: .public undefined?
+                              (template (undefined? )
+                                [(.as .Bit (.is .Any ( )))]))
 
                             (analysis 
                                       [name phase archive state]
@@ -766,8 +774,9 @@
                                                                    it)]
                                         (in [state (extension_analysis name (list.reversed output))])))
 
-                            (template: (text_synthesis )
-                              [{0 #0 {2 #1 }}])
+                            (def: text_synthesis
+                              (template (_ )
+                                [{0 #0 {2 #1 }}]))
 
                             (def: (pairs it)
                               (All (_ a) (-> (List a) (List [a a])))
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 8aa106b28..1e6d515dc 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -27,7 +27,7 @@
     ["[0]" template]]
    ["[0]" meta]]])
 
-(template [   ]
+(with_template [   ]
   [(def: .public ( value)
      (-> (Primitive ) (Primitive ))
      ( value))]
@@ -63,12 +63,14 @@
   [char_to_long "jvm convert char-to-long" "java.lang.Character" "java.lang.Long"]
   )
 
-(template [   ]
-  [(template: .public ( it)
-     [(|> it (.is ) (.as (Primitive )))])
+(with_template [   ]
+  [(def: .public 
+     (template ( it)
+       [(|> it (.is ) (.as (Primitive )))]))
 
-   (template: .public ( it)
-     [(|> it (.is (Primitive )) (.as ))])]
+   (def: .public 
+     (template ( it)
+       [(|> it (.is (Primitive )) (.as ))]))]
 
   [as_boolean .Bit "java.lang.Boolean" of_boolean]
   [as_long .Int "java.lang.Long" of_long]
@@ -76,12 +78,14 @@
   [as_string .Text "java.lang.String" of_string]
   )
 
-(template [  <$>  <$'>  ]
-  [(template: .public ( it)
-     [(|> it (.is ) (.as (Primitive )) <$> (.is (Primitive )))])
+(with_template [  <$>  <$'>  ]
+  [(def: .public 
+     (template ( it)
+       [(|> it (.is ) (.as (Primitive )) <$> (.is (Primitive )))]))
 
-   (template: .public ( it)
-     [(|> it (.is (Primitive )) <$'> (.is (Primitive )) (.as ))])]
+   (def: .public 
+     (template ( it)
+       [(|> it (.is (Primitive )) <$'> (.is (Primitive )) (.as ))]))]
 
   [as_byte .Int ..long_to_byte "java.lang.Long" ..byte_to_long "java.lang.Byte" of_byte]
   [as_short .Int ..long_to_short "java.lang.Long" ..short_to_long "java.lang.Short" of_short]
@@ -281,7 +285,7 @@
 (def: (manual_primitive_type class)
   (-> Text (Maybe Code))
   (case class
-    (^.template [ ]
+    (^.with_template [ ]
       [
        {.#Some (' )}])
     (["boolean" (Primitive "java.lang.Boolean")]
@@ -300,7 +304,7 @@
 (def: (auto_primitive_type class)
   (-> Text (Maybe Code))
   (case class
-    (^.template [ ]
+    (^.with_template [ ]
       [
        {.#Some (' )}])
     (["boolean" .Bit]
@@ -423,7 +427,7 @@
       {#GenericArray param}
       (format "[" (simple_class$ env param))
       
-      (^.template [ ]
+      (^.with_template [ ]
         [{#GenericClass  {.#End}}
          ])
       (["boolean" "[Z"]
@@ -464,7 +468,7 @@
 (def: (pre_walk_replace f input)
   (-> (-> Code Code) Code Code)
   (case (f input)
-    (^.template []
+    (^.with_template []
       [[meta { parts}]
        [meta { (list#each (pre_walk_replace f) parts)}]])
     ([.#Form]
@@ -515,7 +519,7 @@
     (in (`' ((~ (code.text (format "jvm invokestatic" ":" class_name ":" method_name ":" (text.interposed "," arg_decls'))))
              (~+ args))))))
 
-(template [ ]
+(with_template [ ]
   [(def: ( params class_name method_name arg_decls)
      (-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code))
      (do <>.monad
@@ -600,7 +604,7 @@
           (.tuple (do <>.monad
                           [component again^]
                           (case component
-                            (^.template [ ]
+                            (^.with_template [ ]
                               [{#GenericClass  {.#End}}
                                (in {#GenericClass  (list)})])
                             (["[Z" "boolean"]
@@ -1391,7 +1395,7 @@
     _
     return_term))
 
-(template [  ]
+(with_template [  ]
   [(def: ( member return_term)
      (-> Import_Member_Declaration Code Code)
      (case member
@@ -1417,7 +1421,7 @@
   (-> Type_Parameter Code)
   (code.symbol ["" name]))
 
-(template [    ]
+(with_template [    ]
   [(def: ( mode [class expression])
      (-> Primitive_Mode [Text Code] Code)
      (case mode
@@ -1639,7 +1643,7 @@
   (syntax (_ [type (..generic_type^ (list))
               size .any])
     (case type
-      (^.template [ ]
+      (^.with_template [ ]
         [(pattern {#GenericClass  (list)})
          (in (list (` ( (~ size)))))])
       (["boolean" "jvm znewarray"]
@@ -1689,7 +1693,7 @@
         [array_type (meta.type array_name)
          array_jvm_type (type_class_name array_type)]
         (case array_jvm_type
-          (^.template [ ]
+          (^.with_template [ ]
             [
              (in (list (` ( (~ array) (~ idx)))))])
           (["[Z" "jvm zaload"]
@@ -1719,7 +1723,7 @@
         [array_type (meta.type array_name)
          array_jvm_type (type_class_name array_type)]
         (case array_jvm_type
-          (^.template [ ]
+          (^.with_template [ ]
             [
              (in (list (` ( (~ array) (~ idx) (~ value)))))])
           (["[Z" "jvm zastore"]
@@ -1747,5 +1751,6 @@
   (syntax (_ [type (..generic_type^ (list))])
     (in (list (..class_type {#ManualPrM} (list) type)))))
 
-(template: .public (is type term)
-  [(.as type term)])
+(def: .public is
+  (template (is type term)
+    [(.as type term)]))
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index a387237db..037f713c4 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -25,7 +25,7 @@
 
 (abstract: .public (Object brand) Any)
 
-(template []
+(with_template []
   [(with_expansions [ (template.symbol [ "'"])]
      (abstract: .public  Any)
      (type: .public 
@@ -35,7 +35,7 @@
   [Function]
   )
 
-(template [ ]
+(with_template [ ]
   [(type: .public 
      )]
 
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index 8822efd3d..34a35a3c8 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -25,7 +25,7 @@
 
 (abstract: .public (Object brand) Any)
 
-(template []
+(with_template []
   [(with_expansions [ (template.symbol [ "'"])]
      (abstract: .public  Any)
      (type: .public 
@@ -35,7 +35,7 @@
   [Function]
   )
 
-(template [ ]
+(with_template [ ]
   [(type: .public 
      )]
 
diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux
index e8cbc6f8b..46c259fbe 100644
--- a/stdlib/source/library/lux/ffi/export.rb.lux
+++ b/stdlib/source/library/lux/ffi/export.rb.lux
@@ -51,7 +51,7 @@
        ..sigil!
        ))
 
-(template [ ]
+(with_template [ ]
   [(def: 
      (Parser Text)
      (<| .slice
diff --git a/stdlib/source/library/lux/ffi/node_js.js.lux b/stdlib/source/library/lux/ffi/node_js.js.lux
index a31054f74..27d69787d 100644
--- a/stdlib/source/library/lux/ffi/node_js.js.lux
+++ b/stdlib/source/library/lux/ffi/node_js.js.lux
@@ -6,7 +6,7 @@
     ["[0]" function]
     ["[0]" maybe (.open: "[1]#[0]" monoid functor)]]]])
 
-(template [ ]
+(with_template [ ]
   [(def: 
      (Maybe (-> Text Any))
      (ffi.global (-> Text Any) ))]
diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux
index cfc25fe7d..82b4ca4c2 100644
--- a/stdlib/source/library/lux/locale/language.lux
+++ b/stdlib/source/library/lux/locale/language.lux
@@ -17,7 +17,7 @@
    [#name Text
     #code Text])
 
-  (template [ ]
+  (with_template [ ]
     [(def: .public 
        (-> Language Text)
        (|>> representation (the )))]
@@ -26,14 +26,14 @@
     [code #code]
     )
 
-  (template []
+  (with_template []
     [(with_expansions [' (template.spliced )]
-       (template [   +]
+       (with_template [   +]
          [(def: .public 
             Language
             (abstraction [#name 
                           #code ]))
-          (`` (template []
+          (`` (with_template []
                 [(def: .public 
                    Language
                    )]
diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux
index 06e1d3b4a..0d0bca38b 100644
--- a/stdlib/source/library/lux/locale/territory.lux
+++ b/stdlib/source/library/lux/locale/territory.lux
@@ -19,7 +19,7 @@
     #long Text
     #code Nat])
 
-  (template [  ]
+  (with_template [  ]
     [(def: .public 
        (-> Territory )
        (|>> representation
@@ -31,7 +31,7 @@
     [numeric_code #code  Nat]
     )
 
-  (template [    
+] + (with_template [
+] [(def: .public
Territory (abstraction [#name @@ -39,7 +39,7 @@ #long #code ])) - (`` (template [] + (`` (with_template [] [(def: .public Territory
)] (~~ (template.spliced +))))] diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux index a96545566..1aeadcd0c 100644 --- a/stdlib/source/library/lux/macro.lux +++ b/stdlib/source/library/lux/macro.lux @@ -142,7 +142,7 @@ _ (//.failure "Macro expanded to more than 1 element.")))) -(template [ ] +(with_template [ ] [(def: .public (.macro (_ tokens) (let [[module _] (.symbol .._) diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux index 6dc56c320..0131567c7 100644 --- a/stdlib/source/library/lux/macro/code.lux +++ b/stdlib/source/library/lux/macro/code.lux @@ -36,7 +36,7 @@ ... (type: Code ... (Ann Location (Code' (Ann Location)))) -(template [ ] +(with_template [ ] [(def: .public ( x) (-> Code) [location.dummy { x}])] @@ -53,7 +53,7 @@ [tuple (List Code) .#Tuple] ) -(template [ ] +(with_template [ ] [(def: .public ( name) (-> Text Code) [location.dummy { ["" name]}])] @@ -65,7 +65,7 @@ (def: (= x y) (case [x y] - (^.template [ ] + (^.with_template [ ] [[[_ { x'}] [_ { y'}]] (at = x' y')]) ([.#Bit bit.equivalence] @@ -76,7 +76,7 @@ [.#Text text.equivalence] [.#Symbol symbol.equivalence]) - (^.template [] + (^.with_template [] [[[_ { xs'}] [_ { ys'}]] (at (list.equivalence =) = xs' ys')]) ([.#Form] @@ -89,7 +89,7 @@ (def: .public (format ast) (-> Code Text) (case ast - (^.template [ ] + (^.with_template [ ] [[_ { value}] (at encoded value)]) ([.#Bit bit.codec] @@ -102,7 +102,7 @@ [_ {.#Text value}] (text.format value) - (^.template [ ] + (^.with_template [ ] [[_ { members}] (all text#composite @@ -124,7 +124,7 @@ (if (at ..equivalence = original ast) substitute (case ast - (^.template [] + (^.with_template [] [[location { parts}] [location { (list#each (replaced original substitute) parts)}]]) ([.#Form] diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux index b564df336..a921afee1 100644 --- a/stdlib/source/library/lux/macro/local.lux +++ b/stdlib/source/library/lux/macro/local.lux @@ -21,7 +21,7 @@ (exception.report "Module" (text.format module))) -(template [] +(with_template [] [(exception: .public ( [module Text definition Text]) (exception.report diff --git a/stdlib/source/library/lux/macro/pattern.lux b/stdlib/source/library/lux/macro/pattern.lux index 4e6811c93..ecad74d18 100644 --- a/stdlib/source/library/lux/macro/pattern.lux +++ b/stdlib/source/library/lux/macro/pattern.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except or template let |> `)]]) + [lux (.except or let with_template |> `)]]) (def: locally (macro (_ tokens lux) @@ -13,7 +13,7 @@ _ {.#Left ""})))) -(.template [] +(.with_template [] [(def: (..locally ))] [list#size] @@ -85,7 +85,7 @@ _ (failure (..wrong_syntax_error (symbol ..or)))))) -(def: .public template +(def: .public with_template (macro (_ tokens) (case tokens (pattern (partial_list [_ {.#Form (list [_ {.#Tuple bindings}] @@ -110,10 +110,10 @@ (meta#in (list#composite output branches)) {.#None} - (failure (..wrong_syntax_error (symbol ..template)))) + (failure (..wrong_syntax_error (symbol ..with_template)))) _ - (failure (..wrong_syntax_error (symbol ..template)))))) + (failure (..wrong_syntax_error (symbol ..with_template)))))) (def: .public multi (macro (_ tokens) @@ -185,7 +185,7 @@ {.#Item [init inits']} (.` {.#Item (~ init) (~ (untemplated_partial_list last inits'))}))) -(.template [ ] +(.with_template [ ] [(def: ( g!meta untemplated_pattern elems) (-> Code (-> Code (Meta Code)) (-> (List Code) (Meta Code))) @@ -211,7 +211,7 @@ (do meta_monad [g!meta (..generated_symbol "g!meta")] (case pattern - (..template [ ] + (..with_template [ ] [[_ { value}] (in (.` [(~ g!meta) { (~ ( value))}]))]) ([.#Bit bit$] @@ -228,7 +228,7 @@ [_ {.#Form {.#Item [[_ {.#Symbol ["" "~+"]}] {.#Item [spliced {.#End}]}]}}] (failure "Cannot use (~+) inside of `code` unless it is the last element in a form or a tuple.") - (template [ ] + (..with_template [ ] [[_ { elems}] ( g!meta untemplated_pattern elems)]) ([.#Form ..untemplated_form] diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index a510cb759..e4ae7260f 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -85,8 +85,7 @@ {.#None} (//.symbol "g!state")) this_module meta.current_module_name - .let [error_msg (code.text (//.wrong_syntax_error [this_module name])) - g!name (code.symbol ["" name])]] + .let [g!name (code.symbol ["" name])]] (in (list (` (.macro ((~ g!name) (~ g!tokens) (~ g!state)) (.case ((~! .result) (is ((~! .Parser) (Meta (List Code))) @@ -98,7 +97,7 @@ ((~ g!body) (~ g!state)) {try.#Failure (~ g!error)} - {try.#Failure ((~! text.interposed) (~! text.new_line) (list (~ error_msg) (~ g!error)))}))))))) + {try.#Failure ((~! text.interposed) (~! text.new_line) (list "Invalid syntax:" (~ g!error)))}))))))) {try.#Failure error} (meta.failure (//.wrong_syntax_error (symbol ..syntax)))))) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index cec732f01..439c99a3a 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -83,7 +83,7 @@ (syntax (_ [simple (..part false)]) (in (list (|> simple (text.interposed "") code.text))))) -(template [ ] +(with_template [ ] [(def: .public (syntax (_ [name (<>.or (<>.and (..part true) (..part false)) (..part false))]) @@ -112,7 +112,7 @@ {.#None} template) - (^.template [] + (^.with_template [] [[meta { elems}] [meta { (list#each (applied env) elems)}]]) ([.#Form] diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index 9a53b8f0e..01274b28c 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -68,7 +68,7 @@ [ratio.#numerator 1 ratio.#denominator 1] [complex.#real +0.0 complex.#imaginary +0.0] [complex.#real +1.0 complex.#imaginary +0.0]] - (these (template [ '] + (these (with_template [ '] [(with_expansions [ (static.seed) (template.text [<@> " " ]) (template.spliced ')] @@ -88,7 +88,7 @@ (`` (cond (check.subsumes? .I64 :it:) (phase.except ..no_arithmetic_for [:it:]) - (~~ (template [ <0> <+>] + (~~ (with_template [ <0> <+>] [(check.subsumes? :it:) <0>] @@ -101,7 +101,7 @@ (`` (cond (check.subsumes? .I64 :it:) (phase.except ..no_arithmetic_for [:it:]) - (~~ (template [ <0> <+>] + (~~ (with_template [ <0> <+>] [(check.subsumes? :it:) (..composite phase archive (` <+>) last prevs)] @@ -138,7 +138,7 @@ [Ratio (type.expecting Ratio (phase archive (` ))) ratio./] [Complex (type.expecting Complex (phase archive (` ))) complex./]]] ) - (template [ '] + (with_template [ '] [(with_expansions [ (static.seed) (template.text [<@> " " ]) (template.spliced ')] @@ -154,7 +154,7 @@ (`` (cond (check.subsumes? .I64 :it:) (phase.except ..no_arithmetic_for [:it:]) - (~~ (template [ <+>] + (~~ (with_template [ <+>] [(check.subsumes? :it:) (..composite phase archive (` <+>) right (list left))] @@ -194,7 +194,7 @@ [.Frac frac.>=] [Ratio ratio.>=]]] ) - (template [ '] + (with_template [ '] [(with_expansions [ (static.seed) (template.text [<@> " " ]) (template.spliced ')] @@ -210,7 +210,7 @@ (`` (cond (check.subsumes? .I64 :it:) (phase.except ..no_arithmetic_for [:it:]) - (~~ (template [ <+>] + (~~ (with_template [ <+>] [(check.subsumes? :it:) (..composite phase archive (` <+>) right (list left))] diff --git a/stdlib/source/library/lux/math/logic/continuous.lux b/stdlib/source/library/lux/math/logic/continuous.lux index eec2d573f..c72e296d1 100644 --- a/stdlib/source/library/lux/math/logic/continuous.lux +++ b/stdlib/source/library/lux/math/logic/continuous.lux @@ -11,7 +11,7 @@ (def: .public false Rev /#bottom) (def: .public true Rev /#top) -(template [ ] +(with_template [ ] [(def: .public (-> Rev Rev Rev) ) diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux index 679ebc4a7..79555e858 100644 --- a/stdlib/source/library/lux/math/logic/fuzzy.lux +++ b/stdlib/source/library/lux/math/logic/fuzzy.lux @@ -25,7 +25,7 @@ (def: (each f fb) (|>> f fb))) -(template [ ] +(with_template [ ] [(def: .public Fuzzy (function (_ _) @@ -39,7 +39,7 @@ (All (_ a) (-> (Fuzzy a) a Rev)) (set elem)) -(template [ ] +(with_template [ ] [(def: .public ( left right) (All (_ a) (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (function (_ elem) @@ -101,10 +101,11 @@ (..ascending from to) (..descending from to))) -(template: (!sort_2 ) - [(if (/.> ) - [ ] - [ ])]) +(def: !sort_2 + (template (_ ) + [(if (/.> ) + [ ] + [ ])])) (def: .public (triangle bottom middle top) (-> Rev Rev Rev (Fuzzy Rev)) diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index 1af638ee7..09e1b6a31 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -36,7 +36,7 @@ (abstraction [#modulus modulus #value (i.mod (//.divisor modulus) value)])) - (template [ ] + (with_template [ ] [(def: .public (All (_ %) (-> (Mod %) )) (|>> representation ))] @@ -77,7 +77,7 @@ (i.= (//.divisor expected) actual))] (in (..modular expected value)))))) - (template [ ] + (with_template [ ] [(def: .public ( reference subject) (All (_ %) (-> (Mod %) (Mod %) Bit)) (let [[_ reference] (representation reference) @@ -102,7 +102,7 @@ (def: equivalence ..equivalence) (def: < ..<)) - (template [ ] + (with_template [ ] [(def: .public ( param subject) (All (_ %) (-> (Mod %) (Mod %) (Mod %))) (let [[modulus param] (representation param) @@ -117,7 +117,7 @@ [* i.*] ) - (template [ ] + (with_template [ ] [(implementation: .public ( modulus) (All (_ %) (-> (Modulus %) (Monoid (Mod %)))) diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index 3f4fe8c9e..59310fc99 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -31,7 +31,7 @@ (-> Text Text) (text.replaced ..separator "")) -(template [ ] +(with_template [ ] [(def: .public (macro (_ tokens state) (case tokens diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux index 2965f2c12..56e2cefc7 100644 --- a/stdlib/source/library/lux/math/number/complex.lux +++ b/stdlib/source/library/lux/math/number/complex.lux @@ -56,7 +56,7 @@ (f.= (the #imaginary param) (the #imaginary input)))) -(template [ ] +(with_template [ ] [(def: .public ( param input) (-> Complex Complex Complex) [#real ( (the #real param) @@ -73,7 +73,7 @@ (def: = ..=)) -(template [ ] +(with_template [ ] [(def: .public (-> Complex Complex) (|>> (revised #real ) @@ -213,7 +213,7 @@ [..#real (|> subject ..abs f.log) ..#imaginary (f.atan_2 #real #imaginary)])) -(template [ ] +(with_template [ ] [(def: .public ( param input) (-> Complex Complex) (|> input log ( param) exp))] diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index aa58c684f..149ca8e50 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -23,7 +23,7 @@ ["[1][0]" int] ["[1][0]" rev]]) -(template [ ] +(with_template [ ] [(def: .public )] @@ -35,7 +35,7 @@ ) (for @.old - (these (template [ ] + (these (with_template [ ] [(def: .public ( it) (-> Frac Frac) ( it))] @@ -62,18 +62,20 @@ ("jvm invokestatic:java.lang.Math:pow:double,double" subject param))) @.jvm - (these (template: (!double value) - [(|> value - (as (Primitive "java.lang.Double")) - "jvm object cast")]) + (these (def: !double + (template (_ value) + [(|> value + (as (Primitive "java.lang.Double")) + "jvm object cast")])) - (template: (!frac value) - [(|> value - "jvm object cast" - (is (Primitive "java.lang.Double")) - (as Frac))]) + (def: !frac + (template (_ value) + [(|> value + "jvm object cast" + (is (Primitive "java.lang.Double")) + (as Frac))])) - (template [ ] + (with_template [ ] [(def: .public (-> Frac Frac) (|>> !double @@ -106,7 +108,7 @@ !frac))) @.js - (these (template [ ] + (these (with_template [ ] [(def: .public (-> Frac Frac) (|>> [] @@ -136,7 +138,7 @@ (as Frac ("js apply" ("js constant" "Math.pow") [subject param])))) @.python - (these (template [ ] + (these (with_template [ ] [(def: .public (-> Frac Frac) (|>> [] @@ -175,7 +177,7 @@ (..pow ("lux f64 /" +3.0 +1.0)))))) @.lua - (these (template [ ] + (these (with_template [ ] [(def: .public (-> Frac Frac) (|>> [] @@ -214,7 +216,7 @@ (..pow ("lux f64 /" +3.0 +1.0)))))) @.ruby - (these (template [ ] + (these (with_template [ ] [(def: .public (-> Frac Frac) (|>> [] @@ -236,7 +238,7 @@ [root_3 "Math.cbrt"] ) - (template [ ] + (with_template [ ] [(def: .public ( it) (-> Frac Frac) (|> ("ruby object do" it []) @@ -252,7 +254,7 @@ (as Frac ("ruby object do" "**" subject [param])))) @.php - (these (template [ ] + (these (with_template [ ] [(def: .public (-> Frac Frac) (|>> ("php apply" ("php constant" )) @@ -284,7 +286,7 @@ (..pow ("lux f64 /" +3.0 +1.0)))) @.scheme - (these (template [ ] + (these (with_template [ ] [(def: .public (-> Frac Frac) (|>> ("scheme apply" ("scheme constant" )) @@ -372,7 +374,7 @@ ... Hyperbolic functions ... https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions -(template [ ] +(with_template [ ] [(def: .public ( it) (-> Frac Frac) (|> (..exp it) ( (..exp ("lux f64 *" -1.0 it))) ("lux f64 /" +2.0))) @@ -385,7 +387,7 @@ [cosh "lux f64 +" sech] ) -(template [ ] +(with_template [ ] [(def: .public ( it) (-> Frac Frac) (let [e+ (exp it) @@ -399,7 +401,7 @@ ) ... https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Definitions_in_terms_of_logarithms -(template [ ] +(with_template [ ] [(def: .public ( it) (-> Frac Frac) (|> it (pow +2.0) ( +1.0) (pow +0.5) ("lux f64 +" it) log))] @@ -408,7 +410,7 @@ [acosh "lux f64 -"] ) -(template [ ] +(with_template [ ] [(def: .public ( it) (-> Frac Frac) (let [it+ (|> ("lux f64 +" )) @@ -419,7 +421,7 @@ [acoth it +1.0] ) -(template [ ] +(with_template [ ] [(def: .public ( it) (-> Frac Frac) (let [it^2 (|> it (pow +2.0))] @@ -429,7 +431,7 @@ [acsch "lux f64 +"] ) -(template [ ] +(with_template [ ] [(def: .public ( param subject) (-> Frac Frac Bit) ( param subject))] @@ -452,7 +454,7 @@ (or ("lux f64 <" sample reference) ("lux f64 =" sample reference))) -(template [ ] +(with_template [ ] [(def: .public (Predicate Frac) ( +0.0))] @@ -462,7 +464,7 @@ [..= zero?] ) -(template [ ] +(with_template [ ] [(def: .public ( param subject) (-> Frac Frac Frac) ( param subject))] @@ -499,7 +501,7 @@ (def: min_exponent -1022) (def: max_exponent (//int.frac +1023)) -(template [ ] +(with_template [ ] [(def: .public ( left right) (-> Frac Frac Frac) (if ( right left) @@ -534,7 +536,7 @@ "lux f64 i64" ("lux i64 left-shift" ..exponent_size))) -(template [ ] +(with_template [ ] [(def: .public Frac (../ +0.0 ))] @@ -584,7 +586,7 @@ (..- f2^-52) (..* f2^+1023)))) -(template [ ] +(with_template [ ] [(implementation: .public (Monoid Frac) @@ -630,7 +632,7 @@ (def: exponent_offset ..mantissa_size) (def: sign_offset (//nat.+ ..exponent_size ..exponent_offset)) -(template [ ] +(with_template [ ] [(def: (|> (at //nat.hex decoded) @@ -700,7 +702,7 @@ (//i64.zero ..mantissa_size mantissa_bits))) ))) -(template [ ] +(with_template [ ] [(def: (-> (I64 Any) I64) (let [mask (|> 1 (//i64.left_shifted ) -- (//i64.left_shifted ))] @@ -756,7 +758,7 @@ ("lux text index" 0 "E+" representation) ("lux text index" 0 "e-" representation) ("lux text index" 0 "E-" representation)] - (^.template [ ] + (^.with_template [ ] [ (do try.monad [.let [after_offset (//nat.+ 2 split_index) @@ -774,7 +776,7 @@ _ {try.#Success [representation +0]})) -(template [ ] +(with_template [ ] [(implementation: .public (Codec Text Frac) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 36a50c5fe..81cea98f4 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -21,7 +21,7 @@ (n.* ..bits_per_byte ..bytes_per_i64)) -(template [ ] +(with_template [ ] [(def: .public ( parameter subject) (All (_ s) (-> (I64 s) (I64 s))) ( parameter subject))] @@ -86,7 +86,7 @@ (All (_ s) (-> Nat (I64 s) (I64 s))) (|> index ..bit ..not (..and input))) -(template [ ] +(with_template [ ] [(def: .public ( index input) (All (_ s) (-> Nat (I64 s) (I64 s))) (|> index ..bit ( input)))] @@ -103,7 +103,7 @@ (-> Nat (I64 Any) Bit) (.not (..one? index input))) -(template [ ] +(with_template [ ] [(def: .public ( distance input) (All (_ s) (-> Nat (I64 s) (I64 s))) (..or ( distance input) @@ -130,7 +130,7 @@ (def: hash (|>> .nat))) -(template [ ] +(with_template [ ] [(implementation: .public (All (_ a) (Monoid (I64 a))) diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index f4953d6b0..a59608af6 100644 --- a/stdlib/source/library/lux/math/number/int.lux +++ b/stdlib/source/library/lux/math/number/int.lux @@ -21,7 +21,7 @@ ["[1][0]" nat] ["[1][0]" i64]]) -(template [ ] +(with_template [ ] [(def: .public ( param subject) (-> Int Int Bit) ( param subject))] @@ -46,7 +46,7 @@ #1 ("lux i64 =" reference sample))) -(template [ ] +(with_template [ ] [(def: .public (Predicate Int) ( +0))] @@ -56,7 +56,7 @@ [..= zero?] ) -(template [ ] +(with_template [ ] [(def: .public ( left right) (-> Int Int Int) (if ( right left) @@ -67,7 +67,7 @@ [max ..>] ) -(template [ ] +(with_template [ ] [(def: .public ( param subject) (-> Int Int Int) ( param subject))] @@ -190,7 +190,7 @@ ... -9,223,372,036,854,775,808 (//i64.left_shifted 63 +1))) -(template [ ] +(with_template [ ] [(implementation: .public (Monoid Int) @@ -206,7 +206,7 @@ (def: -sign "-") (def: +sign "+") -(template [ ] +(with_template [ ] [(implementation: .public (Codec Text Int) diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index 0e5d5f6d4..988efc62b 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -16,7 +16,7 @@ [macro ["^" pattern]]]]) -(template [ ] +(with_template [ ] [(def: .public ( parameter subject) (-> Nat Nat ) ( parameter subject))] @@ -61,7 +61,7 @@ (or (..< sample reference) ("lux i64 =" reference sample))) -(template [ ] +(with_template [ ] [(def: .public ( left right) (-> Nat Nat Nat) (if ( right left) @@ -167,7 +167,7 @@ (def: top (-- 0)) (def: bottom 0)) -(template [ ] +(with_template [ ] [(implementation: .public (Monoid Nat) @@ -274,18 +274,18 @@ (def: (hexadecimal_value digit) (-> Nat (Maybe Nat)) (case digit - (^.template [ ] + (^.with_template [ ] [(pattern (char )) {.#Some }]) (["0" 0] ["1" 1] ["2" 2] ["3" 3] ["4" 4] ["5" 5] ["6" 6] ["7" 7] ["8" 8] ["9" 9]) - (^.template [ ] + (^.with_template [ ] [(^.or (pattern (char )) (pattern (char ))) {.#Some }]) (["a" "A" 10] ["b" "B" 11] ["c" "C" 12] ["d" "D" 13] ["e" "E" 14] ["f" "F" 15]) _ {.#None})) -(template [ ] +(with_template [ ] [(implementation: .public (Codec Text Nat) diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux index 50ba795b2..df07ca898 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -149,7 +149,7 @@ {.#None} {.#Left (text#composite "Invalid syntax for ratio: " input)}))) -(template [ ] +(with_template [ ] [(implementation: .public (Monoid Ratio) diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux index d919af0b4..7afe11894 100644 --- a/stdlib/source/library/lux/math/number/rev.lux +++ b/stdlib/source/library/lux/math/number/rev.lux @@ -24,7 +24,7 @@ Rev (.rev -1)) -(template [ ] +(with_template [ ] [(def: .public Rev (.rev (//i64.left_shifted (//nat.- //i64.width) 1)))] @@ -65,7 +65,7 @@ (or (..< sample reference) ("lux i64 =" reference sample))) -(template [ ] +(with_template [ ] [(def: .public ( left right) (-> Rev Rev Rev) (if ( right left) @@ -76,7 +76,7 @@ [max ..>] ) -(template [ ] +(with_template [ ] [(def: .public ( param subject) (-> Rev Rev Rev) ( param subject))] @@ -140,7 +140,7 @@ _ (..odd_reciprocal (.nat param)))] (.rev (//nat.* reciprocal (.nat subject))))))) -(template [ ] +(with_template [ ] [(def: .public ( param subject) (-> Rev Rev ) ( ( (.nat param) (.nat subject))))] @@ -149,7 +149,7 @@ [//nat./ ratio |> Nat] ) -(template [ ] +(with_template [ ] [(def: .public ( scale subject) (-> Nat Rev Rev) (.rev ( (.nat scale) (.nat subject))))] @@ -206,7 +206,7 @@ (def: top (.rev -1)) (def: bottom (.rev 0))) -(template [ ] +(with_template [ ] [(implementation: .public (Monoid Rev) @@ -222,7 +222,7 @@ (-> Text Text) ("lux text clip" 1 (-- ("lux text size" input)) input)) -(template [ ] +(with_template [ ] [(with_expansions [ (these {try.#Failure ("lux text concat" repr)})] (implementation: .public (Codec Text Rev) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index f22cc5647..2a05eac36 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -123,7 +123,7 @@ (i64.left_shifted 32) ("lux i64 +" right))]))) -(template [ ] +(with_template [ ] [(def: .public (Random ) (at ..functor each (|>> ) ..i64))] @@ -167,7 +167,7 @@ xs (text char_gen (-- size))] (in (text#composite (text.of_char x) xs))))) -(template [ ] +(with_template [ ] [(def: .public (-> Nat (Random Text)) (..text (..char )))] @@ -181,7 +181,7 @@ [lower_case unicode.lower_case] ) -(template [ ] +(with_template [ ] [(def: .public (Random ) (do ..monad @@ -252,7 +252,7 @@ (in (sequence.suffix x xs))) (at ..monad in sequence.empty))) -(template [ ] +(with_template [ ] [(def: .public ( size value_gen) (All (_ a) (-> Nat (Random a) (Random ( a)))) (do ..monad diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 884945642..f056570b4 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -550,7 +550,7 @@ (|>> (the .#imports) (list.any? (text#= import))) ..current_module)) -(template [ ] +(with_template [ ] [(def: .public ( label_name) (-> Symbol (Meta [Nat (List Symbol) Type])) (do ..monad @@ -666,7 +666,7 @@ {try.#Failure error} {try.#Success [lux {try.#Failure error}]}))) -(template [ ] +(with_template [ ] [(def: .public (Meta ) (function (_ lux) diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux index 18464b10c..cf6675195 100644 --- a/stdlib/source/library/lux/meta/configuration.lux +++ b/stdlib/source/library/lux/meta/configuration.lux @@ -40,7 +40,7 @@ Configuration /.empty) -(template [ ] +(with_template [ ] [(def: Text (text.of_char (hex )))] diff --git a/stdlib/source/library/lux/meta/symbol.lux b/stdlib/source/library/lux/meta/symbol.lux index 43d2277af..a539acea7 100644 --- a/stdlib/source/library/lux/meta/symbol.lux +++ b/stdlib/source/library/lux/meta/symbol.lux @@ -13,7 +13,7 @@ ... (type: Symbol ... [Text Text]) -(template [] +(with_template [] [(def: .public ( [module short]) (-> Symbol Text) )] diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux index 21f749b1c..ea40d2733 100644 --- a/stdlib/source/library/lux/static.lux +++ b/stdlib/source/library/lux/static.lux @@ -17,7 +17,7 @@ [number (.only hex)] ["[0]" random (.only Random)]]]]) -(template [ ] +(with_template [ ] [(def: .public (syntax (_ [expression .any]) (at meta.monad each @@ -64,7 +64,7 @@ (syntax (_ []) (meta#each (|>> code.nat list) meta.seed))) -(template [ ] +(with_template [ ] [(def: .public (syntax (_ []) (do meta.monad diff --git a/stdlib/source/library/lux/target.lux b/stdlib/source/library/lux/target.lux index 0f7d94d8f..66e8ea31b 100644 --- a/stdlib/source/library/lux/target.lux +++ b/stdlib/source/library/lux/target.lux @@ -5,7 +5,7 @@ (type: .public Target Text) -(template [ ] +(with_template [ ] [(def: .public Target )] diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index ce523f4d4..ee50aee0c 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -31,7 +31,7 @@ (-> (Code Any) Text) (|>> representation)) - (template [ ] + (with_template [ ] [(with_expansions [ (template.symbol [ "'"])] (`` (primitive: .public ( brand) Any)) (`` (type: .public ( brand) @@ -45,7 +45,7 @@ [Input Code] ) - (template [ ] + (with_template [ ] [(with_expansions [ (template.symbol [ "'"])] (`` (primitive: .public Any)) (`` (type: .public ( ))))] @@ -66,7 +66,7 @@ Literal (abstraction "()")) - (template [ ] + (with_template [ ] [(def: .public (-> Text Literal) (|>> (format ) abstraction))] @@ -119,7 +119,7 @@ (def: safe (-> Text Text) - (`` (|>> (~~ (template [ ] + (`` (|>> (~~ (with_template [ ] [(text.replaced )] ["\" "\\"] @@ -177,7 +177,7 @@ (-> (Expression Any) (-> (List (Expression Any)) (Computation Any))) (|>> {.#Item func} ..form)) - (template [ ] + (with_template [ ] [(def: .public (-> (List (Expression Any)) (Computation Any)) (..call/* (..var )))] @@ -200,12 +200,12 @@ (transmutation bindings) expression body))) - (template [ + + +] + (with_template [ + + +] [(`` (def: .public ( [(~~ (template.spliced +))] function) (-> [(~~ (template.spliced +))] (Expression Any) (Computation Any)) (..call/* function (list (~~ (template.spliced +)))))) - (`` (template [ ] + (`` (with_template [ ] [(def: .public ( args) (-> [(~~ (template.spliced +))] (Computation Any)) ( args (..var )))] @@ -262,8 +262,8 @@ [format/3 "format"]]] ) - (template [ + +] - [(`` (template [ ] + (with_template [ + +] + [(`` (with_template [ ] [(def: .public ( args) (-> [(~~ (template.spliced +))] (Access Any)) (transmutation ( args (..var ))))] @@ -302,7 +302,7 @@ (-> [(Expression Any) (Expression Any)] (Computation Any)) (concatenate/3 [(..symbol "string") left right])) - (template [ ] + (with_template [ ] [(def: .public ( left right) (-> (Expression Any) (Expression Any) (Computation Any)) (..form (list (..var ) left right)))] @@ -311,7 +311,7 @@ [and "and"] ) - (template [ ] + (with_template [ ] [(def: .public ( [param subject]) (-> [(Expression Any) (Expression Any)] (Computation Any)) (..form (list (..var ) subject param)))] @@ -344,7 +344,7 @@ (-> Var/* (Expression Any) Literal) (..form (list (..var "lambda") (transmutation input) body))) - (template [ ] + (with_template [ ] [(def: .public ( bindings body) (-> (List [Var/1 (Expression Any)]) (List (Expression Any)) (Computation Any)) (..form (partial_list (..var ) @@ -366,7 +366,7 @@ (-> Var/1 Var/* (Expression Any) (Expression Any)) (..form (list (..var "defun") name (transmutation inputs) body))) - (template [ ] + (with_template [ ] [(def: .public (-> (List (Expression Any)) (Computation Any)) (|>> (partial_list (..var )) ..form))] @@ -400,7 +400,7 @@ handler))) handlers)))) - (template [ ] + (with_template [ ] [(def: .public ( conditions expression) (-> (List Text) (Expression Any) (Expression Any)) (case conditions diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index e1d894f56..3ee9dbcfb 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -40,7 +40,7 @@ (-> (Code Any) Text) (|>> representation)) - (template [ +] + (with_template [ +] [(with_expansions [ (template.symbol [ "'"])] (primitive: ( brand) Any) (`` (type: .public (|> Any (~~ (template.spliced +))))))] @@ -51,7 +51,7 @@ [Statement [Code]] ) - (template [ +] + (with_template [ +] [(with_expansions [ (template.symbol [ "'"])] (primitive: Any) (`` (type: .public (|> (~~ (template.spliced +))))))] @@ -63,7 +63,7 @@ [Label [Code]] ) - (template [ ] + (with_template [ ] [(def: .public Literal (abstraction ))] [null "null"] @@ -94,7 +94,7 @@ (def: safe (-> Text Text) - (`` (|>> (~~ (template [ ] + (`` (|>> (~~ (with_template [ ] [(text.replaced )] ["\\" "\"] @@ -213,7 +213,7 @@ ..expression abstraction)) - (template [ ] + (with_template [ ] [(def: .public ( param subject) (-> Expression Expression Computation) (|> (format (representation subject) " " " " (representation param)) @@ -243,7 +243,7 @@ [bit_and "&"] ) - (template [ ] + (with_template [ ] [(def: .public (-> Expression Computation) (|>> representation (text.prefix ) ..expression abstraction))] @@ -253,7 +253,7 @@ ["-" opposite] ) - (template [ ] + (with_template [ ] [... A 32-bit integer expression. (def: .public ( value) (-> Computation) @@ -374,7 +374,7 @@ (-> Label Loop Statement) (abstraction (format (representation label) ": " (representation loop)))) - (template [ <0> <1>] + (with_template [ <0> <1>] [(def: .public <0> Statement (abstraction (format ..statement_suffix))) @@ -387,7 +387,7 @@ ["continue" continue continue_at] ) - (template [ ] + (with_template [ ] [(def: .public (-> Location Expression) (|>> representation @@ -424,13 +424,13 @@ ..block)))) ) -(template [ + + +] +(with_template [ + + +] [(`` (def: .public ( function) (-> Expression (~~ (template.spliced +)) Computation) (.function (_ (~~ (template.spliced +))) (..apply function (list (~~ (template.spliced +))))))) - (`` (template [ ] + (`` (with_template [ ] [(def: .public ( (..var )))] (~~ (template.spliced +))))] diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 2d356943d..856bb7eac 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -88,7 +88,7 @@ (def: (length attribute) (-> Attribute Nat) (case attribute - (^.template [] + (^.with_template [] [{ [name length info]} (|> length //unsigned.value (n.+ ..common_attribute_length))]) ([#Constant] diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index e9cf5735d..7925c5c24 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -82,16 +82,18 @@ (function (_ _) {try.#Success [..no_exceptions _.empty]})) -(template: (try|do ) - [(.case - {try.#Success } - +(def: try|do + (template (_ ) + [(.case + {try.#Success } + - failure - (as_expected failure))]) + failure + (as_expected failure))])) -(template: (try|in ) - [{try.#Success }]) +(def: try|in + (template (_ ) + [{try.#Success }])) (def: (relative#composite left right) (-> Relative Relative Relative) @@ -300,7 +302,7 @@ (try|in [..no_exceptions (bytecode input)])) []]])))) -(template [ ] +(with_template [ ] [(def: U2 (|> //unsigned.u2 try.trusted))] @@ -313,7 +315,7 @@ [$6 6] ) -(template [ ] +(with_template [ ] [(def: Registry (|> //unsigned.u2 try.trusted /registry.registry))] [@_ 0] @@ -324,7 +326,7 @@ [@4 5] ) -(template [ ] +(with_template [ ] [(def: .public (Bytecode Any) (..bytecode @@ -518,7 +520,7 @@ [..relative#identity []]])))) -(template [ ] +(with_template [ ] [(def: .public (Bytecode Any) (do ..monad @@ -568,11 +570,11 @@ "[1]::[0]" ("static" doubleToRawLongBits "manual" [double] long)) -(template [ ] +(with_template [ ] [(def: .public ( value) (-> (Bytecode Any)) (case (|> value ) - (^.template [ ] + (^.with_template [ ] [ (..bytecode $0 $1 @_ [])]) @@ -622,7 +624,7 @@ (..float_bits value)) (..arbitrary_float value) (case (|> value ffi.float_to_double (as Frac)) - (^.template [ ] + (^.with_template [ ] [ (..bytecode $0 $1 @_ [])]) ([+0.0 _.fconst_0] [+1.0 _.fconst_1] @@ -630,11 +632,11 @@ _ (..arbitrary_float value)))) -(template [ ] +(with_template [ ] [(def: .public ( value) (-> (Bytecode Any)) (case (|> value ) - (^.template [ ] + (^.with_template [ ] [ (..bytecode $0 $2 @_ [])]) @@ -668,7 +670,7 @@ (..double_bits value)) (..arbitrary_double value) (case (as Frac value) - (^.template [ ] + (^.with_template [ ] [ (..bytecode $0 $2 @_ [])]) ([+0.0 _.dconst_0] [+1.0 _.dconst_1]) @@ -688,12 +690,12 @@ {try.#Failure error} (..except ..invalid_register [id]))) -(template [ ] +(with_template [ ] [(def: .public ( local) (-> Nat (Bytecode Any)) (with_expansions [' (template.spliced )] (`` (case local - (~~ (template [ ] + (~~ (with_template [ ] [ (..bytecode $0 [])] ')) @@ -728,12 +730,12 @@ [3 _.aload_3 @3]]] ) -(template [ ] +(with_template [ ] [(def: .public ( local) (-> Nat (Bytecode Any)) (with_expansions [' (template.spliced )] (`` (case local - (~~ (template [ ] + (~~ (with_template [ ] [ (..bytecode $0 [])] ')) @@ -768,7 +770,7 @@ [3 _.astore_3 @3]]] ) -(template [ ] +(with_template [ ] [(def: .public (-> (Bytecode Any)) (..bytecode @_ ))] @@ -832,7 +834,7 @@ _ (revised #known (dictionary.has label [stack {.#None}]) tracker))) -(template [ ] +(with_template [ ] [(def: .public ( label) (-> Label (Bytecode Any)) (let [[estimator bytecode] ] @@ -882,7 +884,7 @@ [$2 if_acmpne _.if_acmpne] ) -(template [ ] +(with_template [ ] [(def: .public ( label) (-> Label (Bytecode Any)) (let [[estimator bytecode] ] @@ -1018,7 +1020,7 @@ (-> (Type (<| Return' Value' category)) Text)) (|>> type.reflection reflection.reflection)) -(template [ ] +(with_template [ ] [(def: .public ( class) (-> (Type ) (Bytecode Any)) (do ..monad @@ -1064,7 +1066,7 @@ ... else 1)) -(template [ ] +(with_template [ ] [(def: .public ( class method type) (-> (Type Class) Text (Type Method) (Bytecode Any)) (let [[type_variables inputs output exceptions] (parser.method type)] @@ -1090,7 +1092,7 @@ [#0 invokeinterface _.invokeinterface //constant/pool.interface_method] ) -(template [ <1> <2>] +(with_template [ <1> <2>] [(def: .public ( class field type) (-> (Type Class) Text (Type Value) (Bytecode Any)) (do ..monad @@ -1107,7 +1109,7 @@ [$1 getfield _.getfield/1 _.getfield/2] ) -(template [ <1> <2>] +(with_template [ <1> <2>] [(def: .public ( class field type) (-> (Type Class) Text (Type Value) (Bytecode Any)) (do [! ..monad] diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux index f2ff4b9f9..bcef16e3e 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux @@ -22,7 +22,7 @@ [#limit Limit #stack (Maybe Stack)])) -(template [ ] +(with_template [ ] [(def: .public ( type) (-> (Type Method) (Try Environment)) (do try.monad diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux index a1c60d8d2..e859bb3af 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux @@ -25,7 +25,7 @@ [#stack Stack #registry Registry])) -(template [ ] +(with_template [ ] [(def: .public ( type) (-> (Type Method) (Try Limit)) (do try.monad diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux index 336ab6035..954c2d6fc 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux @@ -46,7 +46,7 @@ ..normal))) (list#mix n.+ 0)))) - (template [ ] + (with_template [ ] [(def: .public (-> (Type Method) (Try Registry)) (|>> ..minimal @@ -74,7 +74,7 @@ (/////unsigned.max/2 (representation needed)) abstraction)) - (template [ ] + (with_template [ ] [(def: .public (-> Register Registry) (let [extra (|> /////unsigned.u2 try.trusted)] diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux index 3c8e419fb..89ea421a1 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux @@ -20,7 +20,7 @@ (primitive: .public Stack U2 - (template [ ] + (with_template [ ] [(def: .public Stack (|> /////unsigned.u2 maybe.trusted abstraction))] @@ -43,7 +43,7 @@ (-> U2 Stack) (|>> abstraction)) - (template [ ] + (with_template [ ] [(def: .public ( amount) (-> U2 (-> Stack (Try Stack))) (|>> representation diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 028a60f47..145fe13e0 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -63,7 +63,7 @@ (type: Opcode Nat) -(template [ ] +(with_template [ ] [(def: Size (|> ///unsigned.u2 try.trusted))] [1 opcode_size] @@ -89,7 +89,7 @@ size) (|>> mutation ((nullary' opcode)))])]) -(template [ ] +(with_template [ ] [(def: Size (|> ..opcode_size @@ -101,7 +101,7 @@ [size/4 ..big_jump_size] ) -(template [ ] +(with_template [ ] [(with_expansions [ (template.symbol ["'" ])] (def: ( opcode input0) (-> Opcode Mutation) @@ -125,7 +125,7 @@ [..size/4 jump/4 Big_Jump binary.has_32! ///signed.value] ) -(template [ ] +(with_template [ ] [(with_expansions [ (template.symbol ["'" ])] (def: ( opcode input0) (-> Opcode Mutation) @@ -229,7 +229,7 @@ (-> Primitive_Array_Type U1) (|>> representation)) - (template [ ] + (with_template [ ] [(def: .public (|> ///unsigned.u1 try.trusted abstraction))] @@ -244,7 +244,7 @@ )) ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5 -(with_expansions [ (template [ ] +(with_expansions [ (with_template [ ] [[ [] []]] ["01" aconst_null] @@ -266,7 +266,7 @@ ["0E" dconst_0] ["0F" dconst_1]) - (template [ ] + (with_template [ ] [[ [[register Register]] [register]]] ["15" iload] @@ -274,7 +274,7 @@ ["17" fload] ["18" dload] ["19" aload]) - (template [ ] + (with_template [ ] [[ [] []]] ["1A" iload_0] @@ -301,7 +301,7 @@ ["2B" aload_1] ["2C" aload_2] ["2D" aload_3]) - (template [ ] + (with_template [ ] [[ [[register Register]] [register]]] ["36" istore] @@ -309,7 +309,7 @@ ["38" fstore] ["39" dstore] ["3A" astore]) - (template [ ] + (with_template [ ] [[ [] []]] ["3B" istore_0] @@ -336,7 +336,7 @@ ["4C" astore_1] ["4D" astore_2] ["4E" astore_3]) - (template [ ] + (with_template [ ] [[ [] []]] ["2E" iaload] @@ -347,7 +347,7 @@ ["33" baload] ["34" caload] ["35" saload]) - (template [ ] + (with_template [ ] [[ [] []]] ["4f" iastore] @@ -358,7 +358,7 @@ ["54" bastore] ["55" castore] ["56" sastore]) - (template [ ] + (with_template [ ] [[ [] []]] ["60" iadd] @@ -397,7 +397,7 @@ ["6F" ddiv] ["73" drem] ["77" dneg]) - (template [ ] + (with_template [ ] [[ [] []]] ["88" l2i] @@ -418,7 +418,7 @@ ["91" i2b] ["92" i2c] ["93" i2s]) - (template [ ] + (with_template [ ] [[ [] []]] ["94" lcmp] @@ -428,7 +428,7 @@ ["97" dcmpl] ["98" dcmpg]) - (template [ ] + (with_template [ ] [[ [] []]] ["AC" ireturn] @@ -438,7 +438,7 @@ ["B0" areturn] ["B1" return] ) - (template [ ] + (with_template [ ] [[ [[jump Jump]] [jump]]] ["99" ifeq] @@ -463,22 +463,22 @@ ["C6" ifnull] ["C7" ifnonnull]) - (template [ ] + (with_template [ ] [[ [[index (Index (Reference Value))]] [(///index.value index)]]] ["B2" getstatic/1] ["B2" getstatic/2] ["B3" putstatic/1] ["B3" putstatic/2] ["B4" getfield/1] ["B4" getfield/2] ["B5" putfield/1] ["B5" putfield/2])] - (template [ ] + (with_template [ ] [(with_expansions [' (template.spliced )] - (template [ ] + (with_template [ ] [(with_expansions [' (template.spliced ) - (template [ ] + (with_template [ ] [] ') - (template [ ] + (with_template [ ] [] ')] diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index 9c224c715..f365b2391 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -129,7 +129,7 @@ (def: .public (writer class) (Writer Class) (`` (all binaryF#composite - (~~ (template [ ] + (~~ (with_template [ ] [( (the class))] [//magic.writer #magic] @@ -139,7 +139,7 @@ [//modifier.writer #modifier] [//index.writer #this] [//index.writer #super])) - (~~ (template [ ] + (~~ (with_template [ ] [((binaryF.sequence_16 ) (the class))] [//index.writer #interfaces] diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 93b959f5d..f8ca85cc0 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -97,7 +97,7 @@ (|>> representation) Equivalence)) - (template [ ] + (with_template [ ] [(type: .public (Value )) @@ -112,7 +112,7 @@ [string String (Index UTF8)] ) - (template [ ] + (with_template [ ] [(def: (Writer ) (`` (|>> representation @@ -137,7 +137,7 @@ [#class (Index Class) #name_and_type (Index (Name_And_Type of))])) -(template [ ] +(with_template [ ] [(def: .public (Equivalence ( Any)) (all product.equivalence @@ -184,7 +184,7 @@ (implementation (def: (= reference sample) (case [reference sample] - (^.template [ ] + (^.with_template [ ] [[{ reference} { sample}] (at = reference sample)]) ([#UTF8 text.equivalence] @@ -242,7 +242,7 @@ )] (function (_ value) (case value - (^.template [ ] + (^.with_template [ ] [{ value} (binaryF#composite (/tag.writer ) ( value))]) diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index 129659e05..b69d7ef21 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -76,64 +76,69 @@ failure (as_expected failure))))) -(template: (try|each ) - [(case - {try.#Success } - - - ... {try.#Failure error} - failure - (as_expected failure))]) - -(template: (try|in ) - [{try.#Success }]) - -(template: (!add ) - [(let [[current pool] - ' ] - (with_expansions [ (these (again (.++ idx)))] - (loop (again [idx 0]) - (case (sequence.item idx pool) - {try.#Success entry} - (case entry - [index { reference}] - (if (at = reference ') - {try.#Success [[current pool] - index]} +(def: try|each + (template (_ ) + [(case + {try.#Success } + + + ... {try.#Failure error} + failure + (as_expected failure))])) + +(def: try|in + (template (_ ) + [{try.#Success }])) + +(def: !add + (template (_ ) + [(let [[current pool] + ' ] + (with_expansions [ (these (again (.++ idx)))] + (loop (again [idx 0]) + (case (sequence.item idx pool) + {try.#Success entry} + (case entry + [index { reference}] + (if (at = reference ') + {try.#Success [[current pool] + index]} + ) + + _ ) - _ - ) - - {try.#Failure _} - (<| (let [new { '}]) - (try|each @new (//unsigned.u2 (//.size new))) - (try|each next (is (Try Index) - (|> current - //index.value - (//unsigned.+/2 @new) - (at try.monad each //index.index)))) - (try|in [[next - (sequence.suffix [current new] pool)] - current]))))))]) - -(template: (/|do ) - [(function (_ ) - )]) - -(template: (/|each ) - [(case ( ) - {try.#Success [ ]} - - - ... {try.#Failure error} - failure - (as_expected failure))]) + {try.#Failure _} + (<| (let [new { '}]) + (try|each @new (//unsigned.u2 (//.size new))) + (try|each next (is (Try Index) + (|> current + //index.value + (//unsigned.+/2 @new) + (at try.monad each //index.index)))) + (try|in [[next + (sequence.suffix [current new] pool)] + current]))))))])) + +(def: /|do + (template (_ ) + [(function (_ ) + )])) + +(def: /|each + (template (_ ) + [(case ( ) + {try.#Success [ ]} + + + ... {try.#Failure error} + failure + (as_expected failure))])) (type: (Adder of) (-> of (Resource (Index of)))) -(template [ ] +(with_template [ ] [(def: .public ( value) (Adder ) (<| (/|do %) @@ -181,7 +186,7 @@ (/|each % @descriptor (..descriptor descriptor)) (!add % //.#Name_And_Type //.name_and_type_equivalence [//.#name @name //.#descriptor @descriptor]))) -(template [ ] +(with_template [ ] [(def: .public ( class member) (-> External (Member ) (Resource (Index (Reference )))) (<| (/|do %) @@ -194,8 +199,9 @@ [interface_method //.#Interface_Method Method] ) -(template: (!index ) - [(|> //index.value //unsigned.value)]) +(def: !index + (template (_ ) + [(|> //index.value //unsigned.value)])) (def: .public writer (Writer Pool) diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 7a859d75b..cf629c062 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -23,7 +23,7 @@ (u1//= (representation reference) (representation sample)))) - (template [ ] + (with_template [ ] [(def: .public Tag (|> ///unsigned.u1 try.trusted abstraction))] diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index a70a557de..9f94e12c1 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -47,7 +47,7 @@ "Value" (%.int value) "Scope (in bytes)" (%.nat scope))) - (template [ <+> <->] + (with_template [ <+> <->] [(with_expansions [ (template.symbol [ "'"])] (primitive: Any) (type: .public (Signed ))) @@ -75,7 +75,7 @@ {try.#Success (abstraction value)} (exception.except ..value_exceeds_the_scope [value ]))))) - (template [ ] + (with_template [ ] [(def: .public ( parameter subject) (-> (Try )) ( @@ -91,7 +91,7 @@ [4 S4 bytes/4 s4 maximum/4 minimum/4 +/4 -/4] ) - (template [ ] + (with_template [ ] [(def: .public (-> ) (|>> transmutation))] @@ -100,7 +100,7 @@ [lifted/4 S2 S4] ) - (template [ ] + (with_template [ ] [(def: .public (Writer ) (|>> representation ))] diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index 8bbc74213..6126469a4 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -59,7 +59,7 @@ "Parameter" (%.nat (representation parameter)) "Subject" (%.nat (representation subject)))) - (template [ <+> <-> ] + (with_template [ <+> <-> ] [(with_expansions [ (template.symbol [ "'"])] (primitive: .public Any) (type: .public (Unsigned ))) @@ -100,7 +100,7 @@ [4 U4 bytes/4 u4 maximum/4 +/4 -/4 max/4] ) - (template [ ] + (with_template [ ] [(def: .public (-> ) (|>> transmutation))] @@ -109,7 +109,7 @@ [lifted/4 U2 U4] ) - (template [ ] + (with_template [ ] [(def: .public (Writer ) (|>> representation ))] diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux index 196bd76f2..32ef049e5 100644 --- a/stdlib/source/library/lux/target/jvm/field.lux +++ b/stdlib/source/library/lux/target/jvm/field.lux @@ -51,7 +51,7 @@ (def: .public (writer field) (Writer Field) (`` (all binaryF#composite - (~~ (template [ ] + (~~ (with_template [ ] [( (the field))] [modifier.writer #modifier] diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux index 261ae04f6..57cc56e41 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -99,7 +99,7 @@ (def: .public (writer field) (Writer Method) (`` (all format#composite - (~~ (template [ ] + (~~ (with_template [ ] [( (the field))] [//modifier.writer #modifier] diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index 68d8d8b7b..3900196fe 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -38,16 +38,18 @@ (representation reference) (representation sample)))) - (template: (!wrap value) - [(|> value - //unsigned.u2 - try.trusted - abstraction)]) + (def: !wrap + (template (_ value) + [(|> value + //unsigned.u2 + try.trusted + abstraction)])) - (template: (!unwrap value) - [(|> value - representation - //unsigned.value)]) + (def: !unwrap + (template (_ value) + [(|> value + representation + //unsigned.value)])) (def: .public (has? sub super) (All (_ of) (-> (Modifier of) (Modifier of) Bit)) @@ -82,7 +84,7 @@ (syntax (_ [ofT .any options (<>.many .any)]) (with_symbols [g!modifier g!code] - (in (list (` (template [(~ g!code) (~ g!modifier)] + (in (list (` (with_template [(~ g!code) (~ g!modifier)] [(def: (~' .public) (~ g!modifier) (..Modifier (~ ofT)) ((~! ..modifier) ((~! number.hex) (~ g!code))))] diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index d903e9fa0..5a76db47d 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -100,7 +100,7 @@ (exception.report "Class" (%.text class))) -(template [] +(with_template [] [(exception: .public ( [jvm_type java/lang/reflect/Type]) (exception.report "Type" (java/lang/reflect/Type::getTypeName jvm_type) @@ -135,7 +135,7 @@ (let [class_name (|> class (as (java/lang/Class java/lang/Object)) java/lang/Class::getName)] - (`` (if (or (~~ (template [] + (`` (if (or (~~ (with_template [] [(text#= (/reflection.reflection ) class_name)] @@ -185,7 +185,7 @@ ... allow for multiple ones. (case [(array.item 0 (java/lang/reflect/WildcardType::getLowerBounds reflection)) (array.item 0 (java/lang/reflect/WildcardType::getUpperBounds reflection))] - (^.template [ ] + (^.with_template [ ] [ (case (ffi.as java/lang/reflect/GenericArrayType bound) {.#Some it} @@ -226,7 +226,7 @@ (let [class_name (|> reflection (as (java/lang/Class java/lang/Object)) java/lang/Class::getName)] - (`` (cond (~~ (template [ ] + (`` (cond (~~ (with_template [ ] [(text#= (/reflection.reflection ) class_name) {try.#Success }] @@ -335,7 +335,7 @@ "Owner" (java/lang/Object::toString owner) "Target" (java/lang/Object::toString target))) -(template [] +(with_template [] [(exception: .public ( [field Text class (java/lang/Class java/lang/Object)]) (exception.report @@ -366,7 +366,7 @@ list.empty? not)) -(template [ ] +(with_template [ ] [(def: .public ( field class) (-> Text (java/lang/Class java/lang/Object) (Try [Bit Bit (/.Type Value)])) (do [! try.monad] diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index cdf8690e9..268743ce0 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -42,7 +42,7 @@ #super_class (Type Class) #super_interfaces (List (Type Class))])) - (template [