Skip to content

Instantly share code, notes, and snippets.

@frenchy64
Created December 2, 2015 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frenchy64/813a4b7d7434fd1f2c36 to your computer and use it in GitHub Desktop.
Save frenchy64/813a4b7d7434fd1f2c36 to your computer and use it in GitHub Desktop.
Pluggable type system idea
(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"))
@frenchy64
Copy link
Author

Related: emiln/slacker#28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment