Is that preferable? The function is only defined for floats (integers or 
complex wouldn't make any sense). Checking would have to occur inside the 
function then, while I thought that it was more preferable to have the type 
dispatch do that.

On Sunday, May 25, 2014 10:20:00 AM UTC-5, Mauro wrote:
>
> I think there is nothing shorter, if you need to dispatch on the type 
> (e.g. if you also have a `foobar` function for say Intergers as well). 
>  Otherwise a function `foobar(a,b)` without type information works just as 
> well and as fast as it will be compiled for the specific input types. 
>
> On Sun, 25 May 2014 08:10:49 -0700 (PDT), James Crist 
> <[email protected]<javascript:>> 
> wrote: 
>
> > Yeah, that's what I've been using. My issue with it is that the 
> > declarations get long for functions with more than 2 arrays. Was hoping 
> > there was a more concise way. 
> > 
> > On Sunday, May 25, 2014 8:16:58 AM UTC-5, Steven G. Johnson wrote: 
> > > 
> > > On Sunday, May 25, 2014 9:14:46 AM UTC-4, Steven G. Johnson wrote: 
> > >> 
> > >> function foo{T1<:FloatingPoint, T2<:FloatingPoint)(a::Array{T2}, 
> > >> b::Array{T2}) 
> > >> 
> > > 
> > > Whoops, two typos.  This should be: 
> > > 
> > >     function foo{T1<:FloatingPoint, T2<:FloatingPoint}(a::Array{T1}, 
> > > b::Array{T2}) 
> > > 
>
>
>

Reply via email to