On Thu, May 12, 2011 at 6:01 AM, Chas Emerick <cemer...@snowtide.com> wrote:
> What David is getting at is that Object-based hints (as we've had all along) 
> don't impact the signature of the generated function's invoke method -- their 
> return types are always Object, and the hint is "just" used to determine 
> which cast to use when the function's return is used in an interop context 
> (and only in interop contexts, since "regular" Clojure functions never have 
> statically-typed arguments).

That's* different from his original claim that you "can't hint return
types", or words to that effect**; you can't enforce return types (as
in, returning the wrong type invariably throws CCE, or else it won't
compile), but you can hint them (and then wrong type used in interop
expression may cause CCE).

With 1.3, it looks like maybe you can enforce primitive return types
in some cases.

* If it even IS what he was getting at. All he posted was a URL, and I
don't think it's at all clear that that was what he meant by doing so.
And yes, that's after clicking through it and having a cursory look
around near the landing site in the code.

** To be exact, he said you can't "specify" return types, "it is a
type hint on the var that happened to store an fn". This reads to me
as implying that hinting (defn ^String foo [] ...) is hinting that foo
references a String rather than an IFn that returns a String, but the
compiler sure seems to interpret foo as referencing an IFn that
returns a String. :)

-- 
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