Rant after trying Rust a bit
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 24 11:42:23 PDT 2015
On 2015-07-24 06:43, Walter Bright wrote:
> Consider the following:
>
> int foo(T: hasPrefix)(T t) {
> t.prefix(); // ok
> bar(t); // error, hasColor was not specified for T
> }
>
> void bar(T: hasColor)(T t) {
> t.color();
> }
>
> Now consider a deeply nested chain of function calls like this. At the
> bottom, one adds a call to 'color', and now every function in the chain
> has to add 'hasColor' even though it has nothing to do with the logic in
> that function. This is the pit that Exception Specifications fell into.
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.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list