205e3aab0650 — Leonard Ritter 6 months ago
* as infix operations have precedence over `:=`, `:=` is now additionally implemented as infix operator so it can be used like before
1 files changed, 13 insertions(+), 0 deletions(-)

M lib/scopes/core.sc
M lib/scopes/core.sc +13 -0
@@ 3865,6 3865,18 @@ let
     ^= = (make-inplace-op ^)
     ..= = (make-inplace-op ..)
 
+    # also supported within infix expressions
+    := =
+        sugar-macro
+            fn expand-infix-let (expr)
+                raising Error
+                let name value = (decons expr)
+                let value =
+                    if (== (countof value) 1)
+                        let k = (decons value)
+                        k
+                    else `value
+                qq [let] [name] = [value]
     as:= = (make-inplace-let-op as)
     <- =
         sugar-macro

          
@@ 3894,6 3906,7 @@ define-infix< 50 >>=; define-infix< 50 <
 define-infix< 50 &=; define-infix< 50 |=; define-infix< 50 ^=
 define-infix< 50 ..=
 
+define-infix* 50 :=
 define-infix* 50 as:=
 
 define-infix> 100 or