Defines and documented ==> and return operators.
h3rald h3rald@h3rald.com
Mon, 28 Dec 2020 03:49:16 +0000
3 files changed,
19 insertions(+),
1 deletions(-)
M
lib/min_lang.nim
→
lib/min_lang.nim
@@ -1058,8 +1058,17 @@
def.symbol("--") do (i: In): i.push("reverse-expect-dequote".newSym) + def.symbol("::") do (i: In): + i.push("operator".newSym) + def.symbol("=>") do (i: In): i.push("apply".newSym) + + def.symbol("==>") do (i: In): + discard # used within operator defs + + def.symbol("return") do (i: In): + discard # used within operator defs def.symbol(">>") do (i: In): i.push("prefix-dequote".newSym)
M
site/contents/reference-lang.md
→
site/contents/reference-lang.md
@@ -12,6 +12,8 @@ {#sig||:||define#}
{#alias||:||define#} +{#alias||::||operator#} + {#sig||~||delete#} {#sig||+||module#}@@ -39,6 +41,9 @@
{#alias||><||infix-dequote#} {#alias||=>||apply#} + +{#op||==>||{{none}}||{{none}}|| +Symbol used to separate input and output calues in operator signatures.#} {#alias||=-=||expect-empty-stack#}@@ -351,6 +356,10 @@ > > 1 3.5 true
> > (int float bool) -- :my-int :my-float :my-bool #} +{#op||return||{{none}}||{{none}}|| +If used within the body quotation of an operator definition, causes the interpreter to stop pushing further body elements on the stack and start pushing tbe operator output values on the stack. + +If used outside of the body quotation of an operator definition, it raises an exception.#} {#op||ROOT||{{none}}||{{d}}|| Returns a module holding a reference to the [ROOT](class:kwd) scope.
M
tests/lang.min
→
tests/lang.min
@@ -264,7 +264,7 @@ when
"not gonna be printed if true!" puts false @result ) - ) operator + ) :: nt"float" ) assert