HS: send can reference sender (+1 test)
Three-part fix: (a) emit-send now builds detail=(dict "sender" me) on (send NAME target) and bare (send NAME) instead of nil, so the receiving handler has access to the sending element. (b) parser parse-atom now recognises the `sender` keyword (previously swallowed as noise) and emits it as (sender). (c) compiler translates bare `sender` symbol and (sender) list-head to (hs-sender event) — a new runtime helper that reads (get (host-get event "detail") "sender"). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -264,8 +264,17 @@
|
||||
name
|
||||
(hs-to-sx (nth ast 2))))
|
||||
((= (len ast) 3)
|
||||
(list (quote dom-dispatch) (hs-to-sx (nth ast 2)) name nil))
|
||||
(true (list (quote dom-dispatch) (quote me) name nil))))))
|
||||
(list
|
||||
(quote dom-dispatch)
|
||||
(hs-to-sx (nth ast 2))
|
||||
name
|
||||
(list (quote dict) "sender" (quote me))))
|
||||
(true
|
||||
(list
|
||||
(quote dom-dispatch)
|
||||
(quote me)
|
||||
name
|
||||
(list (quote dict) "sender" (quote me))))))))
|
||||
(define
|
||||
emit-repeat
|
||||
(fn
|
||||
@@ -650,11 +659,15 @@
|
||||
((number? ast) ast)
|
||||
((string? ast) ast)
|
||||
((boolean? ast) ast)
|
||||
((and (symbol? ast) (= (str ast) "sender"))
|
||||
(list (quote hs-sender) (quote event)))
|
||||
((not (list? ast)) ast)
|
||||
(true
|
||||
(let
|
||||
((head (first ast)))
|
||||
(cond
|
||||
((= head (quote sender))
|
||||
(list (quote hs-sender) (quote event)))
|
||||
((= head (quote null-literal)) nil)
|
||||
((= head (quote not))
|
||||
(list (quote not) (hs-to-sx (nth ast 1))))
|
||||
|
||||
Reference in New Issue
Block a user