Hi,
Am 02.01.2012 um 21:27 schrieb Kevin Downey:
>> (defmacro barr= [ x y]
>> `(java.util.Arrays/equals ^{:tag bytes} ~x
>> ^{:tag bytes} ~y))
>
> The pevious macro is incorrectly written.
And to enlighten the astute reader why (and to use the occasion for a shame
On Jan 2, 2012 11:43 AM, "Sam Ritchie" wrote:
>
> You're right, it's macro more than inlining. Tag metadata doesn't throw
an error, but it doesn't fix the reflection warning either (assuming I'm
doing it correctly):
>
> (defmacro barr= [^{:tag bytes} x ^{:tag bytes} y]
> `(java.util.Arrays/equal
I agree it looks like a type-hinting issue, but since ^bytes x is
reader-expanded to ^{:tag 'bytes} x, I don't see that change making
any difference. I'd be more inclined to try ^"[B" instead, to avoid
the possibility of var resolution.
I don't get the last point. He wants it to be type-hinted so
You're right, it's macro more than inlining. Tag metadata doesn't throw an
error, but it doesn't fix the reflection warning either (assuming I'm doing
it correctly):
(defmacro barr= [^{:tag bytes} x ^{:tag bytes} y]
`(java.util.Arrays/equals ~x ~y))
(defmacro barr= [ x y]
`(java.util.Arrays/
I suspect this has more to do with type-hinting inside a macro. Did you try
adding :tag metadata to those symbols?
As a side note I do find this approach a bit strange. Why not just define a
generic arr= that with multi-arity inlining?
David
On Mon, Jan 2, 2012 at 1:43 PM, Sam Ritchie wrote:
>