On Tue, Apr 20, 2010 at 7:02 PM, Per Vognsen <[email protected]> wrote:
> With the way primitive types are currently supported in the compiler,
> if you wanted it to work the way you expect, you'd need to express the
> complicated arithmetic tower and its grid of type conversions in a
> static form accessible to the compiler. It seems like it would be a
> good amount of work. You can file a feature request for it if you
> want.

Actually, a less elegant, more brute force way would be to add method
implementations for all operand type combinations. For example, you'd
have

static public long add(long x, int y){
        return add(x, (long) y);
}

static public long add(int x, long y){
        return add((long) x, y);
}

and so on.

Unfortunately, there are a whole lot of combinations if you want to
cover the whole arithmetic tower. The issue is that the current
primitive type support relies directly on Java's type system, so you
cannot abstractly express the pattern underlying the arithmetic tower
like you might in some languages with type-level functions.

-Per

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

Reply via email to