Share your thoughts in the 2021 Clojure Community Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

This should work as expected, for example:

{{(Integer. 1N)}}

Probably for {{BigInt}}, {{BigInteger}}, and {{BigDecimal}}.

Method to look at is {{c.l.Reflector.paramArgTypeMatch}}, per Rich in irc.

11 Answers

0 votes
by

Comment made by: trptcolin

Questions posed on the clojure-dev list around how this impacts bit-shift-left: http://groups.google.com/group/clojure-dev/browse_thread/thread/2191cbf0048d8ca6

0 votes
by

Comment made by: ataggart

Patch on CLJ-445 fixes this as well.

0 votes
by

Comment made by: trptcolin

This patch fails a test around bit-shifting a BigInt: (bit-shift-left 1N 10000). The reason is that the patch changes the dispatch of (BigInt, Long) from (Object, Object) to (long, int).

Clearly this can't be applied (unless another change makes it possible), but I'm putting it up as a start of the conversation.

0 votes
by

Comment made by: ataggart

My comment from the mailing list:

If the test breaks it likely means Numbers.shiftLeft(long,int) was
selected over Numbers.shiftLeft(Object,Object). Given that 1N is an
Object (one that can exceed the size of a long), the method selection
is incorrect, thus the patch is broken.


The suggestion of "simply" modifying paramArgTypeMatch is not sufficient since the mechanism for preferring one method over another lives in Compiler, and isn't smart enough to make these sorts of decisions.

0 votes
by

Comment made by: redinger

Considering moving this out of Release.next - soliciting comments from Chas.

0 votes
by
_Comment made by: cemerick_

I'm afraid I don't have any particular insight into the issues involved at this point.  I ran into the problem originally noted a while back, and opened the ticket at Rich's suggestion.  I'm sorry if the text of the ticket led anyone down unfruitful paths…
0 votes
by

Comment made by: lvanderhart

The issues relating to bitshift are moot since the decision was made that bit-shifts are only for 32/64 bit values.

Still a valid issue, but de-prioritized as per Rich.

0 votes
by

Comment made by: alexott

Modified version of original patch

0 votes
by

Comment made by: jafingerhut

Alex, would you mind attaching it with a unique file name? I know that JIRA lets us create multiple attachments with the same file name, and I know we can tell them apart by date and the account of the person who uploaded the attachment, but giving them the same name only seems to invite confusion.

0 votes
by

Comment made by: alexott

Renamed updated patch to unique name

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-666 (reported by cemerick)
...