You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An idea to import functions as operators, but only allowed inside a sym block. This makes it possible to experiment with syntax and create an ad-hoc DSL, without colliding with other operators or affecting how it is used in other projects.
Unary and list arguments could be supported. No newline is needed after an expression.
use io::println as">>".use math::min as."◁".. // Expand as array
a := 2
b := 3
c := 4
d := 5// println(min([2, b, c]))// println(d)
sym {>> 2 ◁ b ◁ c >> d}
One could bind variables in scope and function calls to arguments of an operator.
a := []
use std::push as(mut a)"<<"some(.)
sym {
<< 1 << 2 << 3}// prints `[some(1), some(2), some(3)]`println(a)
Operators works as language sugar that rewrites meta data before passing it to lifetime/type checker and constructing the AST.
The text was updated successfully, but these errors were encountered:
An idea to import functions as operators, but only allowed inside a
sym
block. This makes it possible to experiment with syntax and create an ad-hoc DSL, without colliding with other operators or affecting how it is used in other projects.The order of import defines the precedence.
With optional namespaces this could look like this:
Unary and list arguments could be supported. No newline is needed after an expression.
One could bind variables in scope and function calls to arguments of an operator.
Operators works as language sugar that rewrites meta data before passing it to lifetime/type checker and constructing the AST.
The text was updated successfully, but these errors were encountered: