Created
December 2, 2015 22:43
-
-
Save frenchy64/813a4b7d7434fd1f2c36 to your computer and use it in GitHub Desktop.
Pluggable type system idea
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-core-async-handler! :print-stuff [Any -> nil]) | |
(register-core-typed-emission async/handler (fn [[v kw & args]] `(~v ~kw ~@(map #(add-handler cast % kw) args))) | |
(register-core-typed-emission async/emit! (fn [[v kw & args]] `(~v ~kw ~@(map #(add-handler cast % kw) args))) | |
(handle :print-stuff prn) | |
;=> (handle :print-stuff (cast [Any -> nil] prn)) | |
(emit! :print-stuff "a") | |
;=> (emit! :printf-stuff (cast String "a")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related: emiln/slacker#28