]> gitweb.factorcode.org Git - factor.git/commitdiff
remove the need to name the variable in the hook consultation
authorAlex Maestas <git@se30.xyz>
Wed, 15 Mar 2023 04:24:27 +0000 (04:24 +0000)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 21 Aug 2023 21:28:15 +0000 (14:28 -0700)
basis/delegate/delegate.factor

index 786bbd431d0e4140477c280d7b5a383bc977ca16..ff9574c066feb26222b0d96cacade2430cf62ebb 100644 (file)
@@ -44,7 +44,7 @@ M: tuple-class group-words
 
 TUPLE: consultation group class quot loc ;
 
-TUPLE: hook-consultation < consultation hook-var ;
+TUPLE: hook-consultation < consultation ;
 
 TUPLE: broadcast < consultation ;
 
@@ -54,12 +54,8 @@ TUPLE: broadcast < consultation ;
 : <broadcast> ( group class quot -- consultation )
     [ check-broadcast-group ] 2dip f broadcast boa ;
 
-:: <hook-consultation> ( group class var quot -- hook-consultation )
-    hook-consultation new
-    group >>group
-    class >>class
-    quot >>quot
-    var >>hook-var ;
+: <hook-consultation> ( group class quot -- hook-consultation )
+    f hook-consultation boa ;
 
 : create-consult-method ( word consultation -- method )
     [ class>> swap first create-method dup fake-definition ] keep
@@ -80,7 +76,9 @@ M: broadcast (consult-method-quot)
     '[ _ call [ _ execute ] each ] nip ;
 
 M: hook-consultation (consult-method-quot) ( consultation quot word -- object )
-    [ hook-var>> ] 2dip
+    [ drop ] 2dip ! consultation no longer necessary
+    dup "combination" word-prop var>> ! (quot word var)
+    -rot ! (var quot word)
     '[ _ _ call swap [ _ execute ] with-variable ] ;
 
 : consult-method-quot ( consultation word -- object )
@@ -127,7 +125,7 @@ SYNTAX: CONSULT:
     [ save-location ] [ define-consult ] bi ;
 
 SYNTAX: HOOK-CONSULT:
-    scan-word scan-word scan-word parse-definition <hook-consultation>
+    scan-word scan-word parse-definition <hook-consultation>
     [ save-location ] [ define-consult ] bi ;
 
 SYNTAX: BROADCAST: