say that a binder is a copy, and where %-> is
All checks were successful
Sex CI / build-linux (pull_request) Successful in 5m40s

A match binder looks like a reference to its field and is not one. And
with `.' reading an untyped receiver as a value, nothing said how to
write the arrow by hand.
This commit is contained in:
2026-10-14 17:27:52 +03:00
parent b51cda0af3
commit 0a565046af
2 changed files with 3 additions and 1 deletions

View File

@@ -150,7 +150,8 @@ may be both:
#+end_src
A receiver whose type cannot be worked out --- something out of a header
nothing has parsed --- is read as a value, with a warning saying so.
nothing has parsed --- is read as a value, with a warning saying so. For a
pointer there, ~(%-> p x)~ writes ~p->x~ whatever ~p~ is.
A method is ~(.name receiver args ...)~ and a field is ~(. receiver
name)~, so the shape of a form says which of the two it is without

View File

@@ -16,6 +16,7 @@
(ops expr
(pub fn eval ((self (* const expr))) float
;; v, e, l and r are copies of the fields, not references to them
(match (* self)
((lit (v)) (return v))
((neg (e)) (return (- (.eval e))))