Does this mean putting it in the arglist always works and there is rarely a 
practical reason to do anything else?

On Thursday, November 12, 2015 at 8:36:20 PM UTC+1, Nicola Mometto wrote:
>
> It.. depends :(
>
> If your type hint is a *primitive* then you want to put it in the arglist. 
> If you put it in the Var, the best case scenario is that you'll get either 
> reflection warnings or boxed maths, and the worst case scenario is a 
> Compiler/bytecode error.
>
> If your type hint is an array type hint (^objects, ^ints ..) you want to 
> put it in the arglist or in the Var as a quoted symbol (^{:tag 'objects}).
>
> If your type hint is a non primitive class, you want to put it in the Var 
> or in the arglist as a fully qualified symbol (not necessary anymore since 
> 1.8)
>
> If your type hint is a string representing a class, you can safely put it 
> in either place.
>
> On 12 Nov 2015, at 19:28, Michael Blume <blume...@gmail.com <javascript:>> 
> wrote:
>
> Sorry, I'm confused now -- is the appropriate place to give a return type 
> hint for a function the arg list and not the function name? I've always 
> seen the function name hinted.
>
> On Thu, Nov 12, 2015 at 11:20 AM Nicola Mometto <brob...@gmail.com 
> <javascript:>> wrote:
>
>> Also just like the CLJ-1846 issue, this bit of code was valid pre 1.8
>>
>> On 12 Nov 2015, at 19:14, Nicola Mometto <brob...@gmail.com <javascript:>> 
>> wrote:
>>
>>
>> Depends on how you look at it.
>> From my point of view, both examples are using an otherwise valid type 
>> hint, at an invalid location, and in both cases the emitted code is 
>> nonsensical.
>> So I'd say that if the decision for the CLJ-1846 issue was to handle that 
>> with a compile time error, this one should too.
>>
>>
>> On 12 Nov 2015, at 16:47, Alex Miller <al...@puredanger.com <javascript:>> 
>> wrote:
>>
>> Neither is acceptable, so I either misunderstand or disagree with your 
>> question. :) 
>>
>> The code below is an invalid type hint at that location. Are you maybe 
>> saying this should throw an error on definition?
>>
>> CLJ-1846 is instead a valid type hint that is in conflict with the call. 
>> Which now throws an error.
>>
>>
>> On Thursday, November 12, 2015 at 10:13:13 AM UTC-6, Nicola Mometto wrote:
>>>
>>> This is :rettag in action.
>>> Any reason why this error should be acceptable while the CLJ-1846 one 
>>> isn't?
>>>
>>> On 12 Nov 2015, at 12:55, Alex Miller <al...@puredanger.com 
>>> <javascript:>> wrote:
>>>
>>> That's not a valid type hint. Var meta is evaluated, in this case to the 
>>> double function object. You really want:
>>>
>>> (defn timespi ^double [^double x] (* x 3.14))
>>>
>>>
>>> On Thursday, November 12, 2015 at 3:57:44 AM UTC-6, rebo...@gmail.com 
>>> <javascript:> wrote:
>>>>
>>>> Hello,
>>>>
>>>> the following stops executing on 1.8.0-rc1 or current master-head 
>>>> (9448d627e091bc010e68e05a5669c134cd715a98, 1.8-RC1 plus Rich fix 
>>>> for CLJ-1846):
>>>>
>>>> [/Users/reborg]$ repl
>>>> Clojure 1.8.0-master-SNAPSHOT
>>>> user=> (defn ^double timespi [^double x] (* x 3.14))
>>>> #'user/timespi
>>>> user=> (timespi 2)
>>>> AbstractMethodError Method user$timespi.invokePrim(D)Ljava/lang/Object; 
>>>> is abstract  user/timespi (NO_SOURCE_FILE:-1)
>>>>
>>>> It works if you enable direct linking (or if you use 1.7.0).
>>>>
>>>> Renzo
>>>>
>>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com <javascript:>
> Note that posts from new members are moderated - please be patient with 
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+u...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to