I am sadly quite clueless when it comes to Java.
De-compiling the Scala class file to Java gives me the following:
public <T> AtomicDist<T> apply(Seq<Tuple2<Object, Element<T>>> clauses,
Name<T> name, ElementCollection collection) {
return new AtomicDist(name, clauses.toList(), collection);
}
public <T> CompoundDist<T> apply(Seq<Tuple2<Element<Object>,
Element<T>>> clauses, Name<T> name, ElementCollection collection) {
return new CompoundDist(name, clauses.toList(), collection);
}
Generics all over the place. Would this even be callable from Java 1.4?
On Thu, Jun 25, 2015 at 2:13 PM Ambrose Bonnaire-Sergeant <
[email protected]> wrote:
> Do you know how to call this method from Java 1.4? That will probably give
> enough context to use in Clojure type hints.
>
> Thanks,
> Ambrose
>
> On Thu, Jun 25, 2015 at 9:03 PM, Stephen Wakely <[email protected]
> > wrote:
>
>> Interesting. That could be a good last resort.
>>
>> On Thu, Jun 25, 2015 at 1:27 PM Andy Fingerhut <[email protected]>
>> wrote:
>>
>>> Sorry, I do not know whether Clojure can or cannot determine the correct
>>> overload in this situation.
>>>
>>> All I have is a weak suggestion that work well enough: have you
>>> considered creating wrapper functions, e.g. in Scala or Java, that have
>>> different enough function signatures that Clojure can easily determine the
>>> correct one?
>>>
>>> Andy
>>>
>>> On Thu, Jun 25, 2015 at 1:54 AM, Stephen Wakely <
>>> [email protected]> wrote:
>>>
>>>> I am trying to call into some Scala that has the following overloaded
>>>> methods :
>>>>
>>>> def apply[T](clauses: (Double, Element[T])*)(implicit name: Name[T],
>>>> collection: ElementCollection) =
>>>> new AtomicDist(name, clauses.toList, collection)
>>>>
>>>> def apply[T](clauses: (Element[Double], Element[T])*)(implicit name:
>>>> Name[T], collection: ElementCollection) =
>>>> new CompoundDist(name, clauses.toList, collection)
>>>>
>>>> So one method takes a list of tuples of Double to Element and the other
>>>> method takes a list of tuples of Element to Element.
>>>>
>>>> I am using t6.from-scala (https://github.com/t6/from-scala) to build
>>>> up my list of Tuples. But when building these up there is no way to specify
>>>> explicit type information about the collections. Consequently when calling
>>>> this apply method Clojure will always choose to call the first method -
>>>> even when my list is a collection of Element to Element tuples.
>>>>
>>>> I can definitely appreciate how it is going to be tricky for Clojure to
>>>> determine the correct overload to use here. Is there any way I can somehow
>>>> force it to call the correct overload myself?
>>>>
>>>>
>>>> Thanks
>>>>
>>>> Stephen
>>>>
>>>> --
>>>> 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
>>>> ---
>>>> 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 [email protected].
>>>> 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 [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
>>> ---
>>> 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 [email protected].
>>> 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 [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
>> ---
>> 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 [email protected].
>> 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 [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
> ---
> 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 [email protected].
> 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 [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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.