Rant after trying Rust a bit
Tofu Ninja via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 24 14:27:07 PDT 2015
On Friday, 24 July 2015 at 19:10:33 UTC, Walter Bright wrote:
> On 7/24/2015 11:42 AM, Jacob Carlborg wrote:
>> I don't see the difference compared to a regular parameter. If
>> you don't specify
>> any constraints/traits/whatever it like using "Object" for all
>> your parameter
>> types in Java.
>
> So constraints then will be an all-or-nothing proposition? I
> believe that would make them essentially useless.
>
> I suspect I am not getting across the essential point. If I
> have a call tree, and at the bottom I add a call to interface
> X, then I have to add a constraint that additionally specifies
> X on each function up the call tree to the root. That is
> antiethical to writing generic code, and will prove to be more
> of a nuisance than an asset.
>
> Exactly what sunk Exception Specifications.
But thats exactly how normal interfaces work...
eg:
interface Iface{ void foo(){} }
void func1(Iface x){ func2(x); }
void func2(Iface x){ func3(x); }
void func3(Iface x){ x.bar(); } // ERROR no bar in Iface
Only options here are A: update Iface to have bar() or B: make a
new interface and change it on the whole tree. The same "problem"
would exist for the concepts, but its the reason why people want
it.
More information about the Digitalmars-d
mailing list