Le jeudi 21 avril 2016 à 11:00 -0400, Yichao Yu a écrit :
> On Thu, Apr 21, 2016 at 10:55 AM, Stefan Karpinski  wrote:
> > 
> > This is probably more of a julia-dev topic, but my gut reaction is that the
> > combination of multiple dispatch and implicit conversion would be chaos.
> > Following method calls can be tricky enough (much easier with Gallium,
> > however) with just dispatch in the mix. With implicit conversion too, it
> > seems like it would be nearly impossible to know what might or might not be
> > called. I think it would be too easy to accidentally invoke a method that
> > wasn't intended.
> I think the proposal was to add an automatic conversion on top of the
> dispatch. so
> 
> f(a::Integer as Int) = ... will be effectively translated to
> f(_a::Integer) = (a = convert(Int, _a)::Int; ...)
For reference, this recently came up in a PR regarding 'as':
https://github.com/JuliaLang/julia/pull/15818#issuecomment-207922230


Regards


> > On Thu, Apr 21, 2016 at 9:05 AM, Didier Verna 
> > wrote:
> > > 
> > > 
> > > 
> > >   This is just an idea from the top of my head, probably wild and maybe
> > >   silly. I haven't given it any serious thought.
> > > 
> > > Given the existence of the general promotion system (which I like a lot,
> > > along with other things in Julia, such as the functor capabilities), I'm
> > > wondering about automatic specialization.
> > > 
> > > What I mean is this: suppose you have a type Foo which can be converted
> > > to an Int. Suppose as well that you have a function bar that only works
> > > on Ints. You cannot currently call bar with a Foo, but since Foo is
> > > convertible to an Int, it could make sense that bar() suddenly becomes
> > > an applicable method, with implicit conversion...
> > > 
> > > --
> > > ELS'16 registration open! http://www.european-lisp-symposium.org
> > > 
> > > Lisp, Jazz, Aïkido: http://www.didierverna.info
> > 

Reply via email to