From: John Benediktsson Date: Fri, 15 Apr 2016 03:19:54 +0000 (-0700) Subject: delegate: use string word-prop keys. X-Git-Tag: unmaintained~1179 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=1a7547f33a23a45a5868ed3e5c57d0370cbb14dc delegate: use string word-prop keys. --- diff --git a/basis/delegate/delegate-tests.factor b/basis/delegate/delegate-tests.factor index 9c79c5e8e5..845e227e61 100644 --- a/basis/delegate/delegate-tests.factor +++ b/basis/delegate/delegate-tests.factor @@ -192,7 +192,7 @@ DEFER: seq-delegate { t } [ seq-delegate - sequence-protocol \ protocol-consult word-prop + sequence-protocol "protocol-consult" word-prop key? ] unit-test @@ -205,7 +205,7 @@ DEFER: seq-delegate { f } [ seq-delegate - sequence-protocol \ protocol-consult word-prop + sequence-protocol "protocol-consult" word-prop key? ] unit-test diff --git a/basis/delegate/delegate.factor b/basis/delegate/delegate.factor index 6a18de6c0e..e1c44d1efa 100644 --- a/basis/delegate/delegate.factor +++ b/basis/delegate/delegate.factor @@ -12,10 +12,10 @@ ERROR: broadcast-words-must-have-no-outputs group ; ( group class quot -- consultation ) f consultation boa ; + : ( group class quot -- consultation ) [ check-broadcast-group ] 2dip f broadcast boa ; @@ -64,6 +66,7 @@ GENERIC# (consult-method-quot) 2 ( consultation quot word -- object ) M: consultation (consult-method-quot) '[ _ call _ execute ] nip ; + M: broadcast (consult-method-quot) '[ _ call [ _ execute ] each ] nip ; @@ -81,7 +84,7 @@ M: broadcast (consult-method-quot) [ [ group>> group-words ] keep ] dip curry each ; inline : register-consult ( consultation -- ) - [ group>> \ protocol-consult ] [ ] [ class>> ] tri + [ group>> "protocol-consult" ] [ ] [ class>> ] tri '[ [ _ _ ] dip ?set-at ] change-word-prop ; : consult-methods ( consultation -- ) @@ -89,7 +92,7 @@ M: broadcast (consult-method-quot) : unregister-consult ( consultation -- ) [ class>> ] [ group>> ] bi - \ protocol-consult word-prop delete-at ; + "protocol-consult" word-prop delete-at ; : unconsult-method ( word consultation -- ) [ class>> swap first ?lookup-method ] keep @@ -146,9 +149,9 @@ M: consultation forget* : initialize-protocol-props ( protocol wordlist -- ) [ - drop \ protocol-consult + drop "protocol-consult" [ H{ } assoc-like ] change-word-prop - ] [ { } like \ protocol-words set-word-prop ] 2bi ; + ] [ { } like "protocol-words" set-word-prop ] 2bi ; : fill-in-depth ( wordlist -- wordlist' ) [ dup word? [ 0 2array ] when ] map ; @@ -181,7 +184,6 @@ PREDICATE: protocol < word protocol-words ; ! Subclass of symbol? M: protocol forget* [ f forget-old-definitions ] [ call-next-method ] bi ; - M: protocol definition protocol-words show-words ; M: protocol definer drop \ PROTOCOL: \ ; ;