Rant after trying Rust a bit
Bruno Queiroga via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 24 19:55:14 PDT 2015
On Saturday, 25 July 2015 at 01:15:52 UTC, Walter Bright wrote:
> On 7/24/2015 4:19 PM, Bruno Queiroga wrote:
>> Could not the compiler just issue a warning
>
> Please, no half features. Code should be correct or not.
>
...
> ... (consider if bar was passed as an alias)
trait S1 { void m1(); }
trait S2 : S1 { void m2(); }
void bar(S : S2)(S s) {
s.m1(); // ok...
s.m2(); // ok...
}
template foo(S : S1) {
static void foo(alias void f(S))(S s) {
s.m1(); // ok...
s.m2(); // ERROR: S1 is the base trait of S
f(s); // Ignored: typeof(s) is S of f(S)
}
}
void main(string[] args) {
S2 s2;
alias foo!S2 fooS2;
alias bar!S2 barS2;
fooS2!barS2(s2);
}
??
More information about the Digitalmars-d
mailing list