Rant after trying Rust a bit

Sebastiaan Koppe via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 25 20:50:18 PDT 2015


On Sunday, 26 July 2015 at 00:31:48 UTC, Jonathan M Davis wrote:
> auto foo(T)(T t)
>     if(cond1!T && cond2!T && cond3!T && cond4!T && cond5!T && 
> cond6!T && cond7!T)
> {
>     ...
>     auto b = bar(t);
>     ...
>     auto c = baz(t);
>     ...
> }
>
> auto bar(T)(T t)
>     if(cond2!T && cond3!T)
> {
>     ...
>     auto l = lark(t);
>     ...
> }
>
> auto baz(T)(T t)
>     if(cond1!T && cond4!T)
> {
>     ...
>     auto s = stork(t);
>     ...
> }
>
>
> auto lark(T)(T t)
>     if(cond5!T && cond6!T)
> {
>     ...
> }
>
> auto stork(T)(T)
>     if(cond2!T && cond3!T && cond7!T)
> {
>     auto w = wolf(t);
> }
>
> auto wolf(T)(T)
>     if(cond7!T)
> {
>     ...
> }
>

Regardless of this debate, it would be great if template 
constraints could be inferred. It seems rather trivial.

Although I understand that a lot of times the compiler doesn't 
have the function's body at hand.


More information about the Digitalmars-d mailing list