Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize the cost of s/fn-schema support for s/letfn #431

Open
frenchy64 opened this issue Nov 5, 2021 · 1 comment
Open

Minimize the cost of s/fn-schema support for s/letfn #431

frenchy64 opened this issue Nov 5, 2021 · 1 comment

Comments

@frenchy64
Copy link
Contributor

#430 revealed a faster way to support s/fn-schema via metadata. We should look into the performance improvements of using the same strategy for s/letfn and then perhaps deprecate schematize-fn.

Idea:

(s/letfn [(f [a ...])]
  ...)
=>
(letfn [(f [a ...])]
  (let [f ^{:schema ...} (fn [a ..] (f a ...)))]
    ...))
@frenchy64
Copy link
Contributor Author

Another idea, but unfortunately it doesn't work:

user=> (letfn* [f ^:a (fn f [])] (meta f))
CompilerException java.lang.ClassCastException: class clojure.lang.Compiler$MetaExpr cannot be cast to class clojure.lang.Compiler$ObjExpr (clojure.lang.Compiler$MetaExpr and clojure.lang.Compiler$ObjExpr are in unnamed module of loader 'app'), compiling:(/private/var/folders/s5/309818k92r92zn9c_nzvmnzc0000gn/T/form-init5989770558247704827.clj:1:1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant