[Issue 19749] Inout causes wrong type inference
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Mar 18 13:51:05 UTC 2019
    
    
  
https://issues.dlang.org/show_bug.cgi?id=19749
--- Comment #3 from Ali Ak <ali.akhtarzada at gmail.com> ---
What do you mean that's how inout works? It works by changing your types? Why
is it secretly changing my types?
And try adding a function that takes an S!T instead of a catch all and simple
inference doesn't work anymore. It's not scalable to have opaque types on every
function:
auto f(T)(auto ref S!T s) {
    return make(s);
}
Also, if inout changes the type that you expect then even more insanity ensues:
struct S(T) {
  static if (is(T == char[])) {
    // implement 1
  } else {
    // implement 2
  }
}
auto a = make("hi"); // implementation 1
auto b = S!string("hi") // implementation 2
--
    
    
More information about the Digitalmars-d-bugs
mailing list