Re: Why no multiple-dispatch?

2014-08-27 Thread Aerolite via Digitalmars-d-learn
On Monday, 25 August 2014 at 17:16:10 UTC, Idan Arye wrote: This CAN NOT BE DONE at compile-time, since the compiler doesn't know at compile time the exact subclass of the instance it'll get at runtime. To clarify: I'm not talking about the creation of the multi-method mechanism - which *can*

Re: Why no multiple-dispatch?

2014-08-25 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 02:04:43 UTC, Aerolite wrote: On Monday, 25 August 2014 at 01:34:14 UTC, Idan Arye wrote: On Monday, 25 August 2014 at 01:10:32 UTC, Aerolite wrote: -- No syntax modification (unless you want the feature to be optional) If this ever gets into the core language,

Re: Why no multiple-dispatch?

2014-08-25 Thread via Digitalmars-d-learn
On Monday, 25 August 2014 at 07:36:22 UTC, Idan Arye wrote: Are you suggesting the compiler will try to resolve the polymorphism at compile-time, looking at all possible paths that lead to a function call to check all possible runtime values it's object arguments can get? I've argued for

Re: Why no multiple-dispatch?

2014-08-25 Thread Aerolite via Digitalmars-d-learn
On Monday, 25 August 2014 at 07:36:22 UTC, Idan Arye wrote: If multi-dispatching is done at compile-time, it can't rely on the object's runtime type - only on the static type of the reference that holds it. This is no different than regular function overloading that we already have. Well any

Re: Why no multiple-dispatch?

2014-08-25 Thread Aerolite via Digitalmars-d-learn
On Monday, 25 August 2014 at 08:45:15 UTC, Ola Fosheim Grøstad wrote: However, why do you want multiple dispatch? I cannot think of any application level use scenario where you have two class hierarchies that you have no control over. So I don't really see the value of multiple dispatch in a

Re: Why no multiple-dispatch?

2014-08-25 Thread via Digitalmars-d-learn
On Monday, 25 August 2014 at 10:16:29 UTC, Aerolite wrote: Well there are a few go-to use-cases, the handling of collisions between objects in a game-engine being the most well-known (which requires Double-Dispatch). I think a game engine is better off using a simple table or a more

Re: Why no multiple-dispatch?

2014-08-25 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 10:02:41 UTC, Aerolite wrote: On Monday, 25 August 2014 at 07:36:22 UTC, Idan Arye wrote: If multi-dispatching is done at compile-time, it can't rely on the object's runtime type - only on the static type of the reference that holds it. This is no different than

Re: Why no multiple-dispatch?

2014-08-25 Thread via Digitalmars-d-learn
On Monday, 25 August 2014 at 17:16:10 UTC, Idan Arye wrote: * Alternative implementations need to implement them(even though the frontend is shared, there can always be some complications(plus I think mutli-methods might need some backend modifications as well, thhoguh I'm no expert on that

Re: Why no multiple-dispatch?

2014-08-25 Thread via Digitalmars-d-learn
On Monday, 25 August 2014 at 17:28:45 UTC, Ola Fosheim Grøstad wrote: Then extend the typeinfo of classes in the first param with a minimal typeid and 2D table that lists all combinations that the custom linker can find based on the mangling? Maybe it would be better to put in the restriction

Why no multiple-dispatch?

2014-08-24 Thread Aerolite via Digitalmars-d-learn
Hey all, I was surprised to learn yesterday that D does not actually support Multiple-Dispatch, also known as Multimethods. Why is this? Support for this feature is already present in Scala, C# 4.0, Groovy, Clojure, etc... Would it not make sense for D to remain competitive in this regard?

Re: Why no multiple-dispatch?

2014-08-24 Thread bearophile via Digitalmars-d-learn
Aerolite: I was surprised to learn yesterday that D does not actually support Multiple-Dispatch, also known as Multimethods. Why is this? Support for this feature is already present in Scala, C# 4.0, Groovy, Clojure, etc... Would it not make sense for D to remain competitive in this regard? I

Re: Why no multiple-dispatch?

2014-08-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, 24 August 2014 at 23:42:51 UTC, Aerolite wrote: Hey all, I was surprised to learn yesterday that D does not actually support Multiple-Dispatch, also known as Multimethods. Why is this? Support for this feature is already present in Scala, C# 4.0, Groovy, Clojure, etc... Would it not

Re: Why no multiple-dispatch?

2014-08-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 24 August 2014 at 23:42:51 UTC, Aerolite wrote: So what seems to be the situation here? Hi Aerolite, I've never used multiple dispatch in any language, but from looking at the C# syntax here[1]: ReactSpecialization(me as dynamic, other as dynamic); You should be able to

Re: Why no multiple-dispatch?

2014-08-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 25 August 2014 at 00:20:26 UTC, Vladimir Panteleev wrote: dynamic!ReactSpecialization(me, other); Here's a very basic implementation: http://dpaste.dzfl.pl/5150ca9c13f4 Idan Arye is also working on functional pattern matching for object references:

Re: Why no multiple-dispatch?

2014-08-24 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 00:08:25 UTC, Jonathan M Davis wrote: On Sunday, 24 August 2014 at 23:42:51 UTC, Aerolite wrote: Hey all, I was surprised to learn yesterday that D does not actually support Multiple-Dispatch, also known as Multimethods. Why is this? Support for this feature is

Re: Why no multiple-dispatch?

2014-08-24 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 00:36:40 UTC, Vladimir Panteleev wrote: On Monday, 25 August 2014 at 00:20:26 UTC, Vladimir Panteleev wrote: dynamic!ReactSpecialization(me, other); Here's a very basic implementation: http://dpaste.dzfl.pl/5150ca9c13f4 Idan Arye is also working on functional

Re: Why no multiple-dispatch?

2014-08-24 Thread Aerolite via Digitalmars-d-learn
On Monday, 25 August 2014 at 00:08:25 UTC, Jonathan M Davis wrote: At this point, if something can be implemented in a library rather than in the language, the odds are low that it will be solved in the language. The language is very powerful and already a bit complicated, so usually the

Re: Why no multiple-dispatch?

2014-08-24 Thread Aerolite via Digitalmars-d-learn
On Monday, 25 August 2014 at 00:20:26 UTC, Vladimir Panteleev wrote: On Sunday, 24 August 2014 at 23:42:51 UTC, Aerolite wrote: So what seems to be the situation here? Hi Aerolite, I've never used multiple dispatch in any language, but from looking at the C# syntax here[1]:

Re: Why no multiple-dispatch?

2014-08-24 Thread Aerolite via Digitalmars-d-learn
On Monday, 25 August 2014 at 00:42:41 UTC, Idan Arye wrote: Speaking of library solutions, I checked with my `castSwitch` PR and it managed to implement single-argument multi-dispatch: https://github.com/D-Programming-Language/phobos/pull/1266#issuecomment-53217374 I'll try to get it to

Re: Why no multiple-dispatch?

2014-08-24 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 01:10:32 UTC, Aerolite wrote: -- No syntax modification (unless you want the feature to be optional) If this ever gets into the core language, it absolutely must be optional! Think of the implications of having this as the default and only behavior: * Every

Re: Why no multiple-dispatch?

2014-08-24 Thread Aerolite via Digitalmars-d-learn
On Monday, 25 August 2014 at 01:34:14 UTC, Idan Arye wrote: On Monday, 25 August 2014 at 01:10:32 UTC, Aerolite wrote: -- No syntax modification (unless you want the feature to be optional) If this ever gets into the core language, it absolutely must be optional! Think of the implications of

Re: Why no multiple-dispatch?

2014-08-24 Thread ketmar via Digitalmars-d-learn
On Mon, 25 Aug 2014 01:14:19 + Aerolite via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I just can't help but think that really, such a feature should be at the language level. this is the first topic about multiple-dispatch in at least... eh... 6 months (maybe more).