Type hints are just metadata. Instead of emitting the type-hint from
the macro, you set the :tag metadata on the relevant symbol.


On Sep 28, 5:20 pm, nathanmarz <nathan.m...@gmail.com> wrote:
> I'm having problems creating functions with the type hints generated
> dynamically.
>
> As a contrived example (my actual use case is somewhat complicated),
> let's say I want to make a macro that takes in as input a class symbol
> and returns a type hinted function that calls a method on the
> argument:
>
> (defmacro hinted-fn [class-sym]
>   `(fn [~(symbol (str "^" class-sym)) arg#] (.get_val arg#)))
>
> This doesn't work, as it ends up creating a function of two arguments.
> Is there any way to make this work?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to