3 ms·
> If your code looks like this: f(g(x, y), a(b(c))) then inference isn't really doing much to hurt you. Err... do you mean to say type inference isn't doing mu
by ErotemeObelus 7y ago
> If your code looks like this: f(g(x, y), a(b(c))) then inference isn't really doing much to hurt you.
Err... do you mean to say type inference isn't doing much to help you?
- mrgriffin 7y agoNot OP but I think hurt is correct. My understanding is that if you're passing return values directly into functions then there's nowhere to annotate the types of those values, but many (most?) people are perfectly okay with that even though you could argue that the types are being inferred (in that they're being left implicit, just as they are when you say: var gxy = g(x, y) var abc = a(b(c)) f(gxy, abc)
- nv-vn 7y agoWhat I mean is that the code var a = f(x) var b = g(y, a) Isn't any different from: g(y, f(x)) A lot of real world code I encounter doesn't bother with temporary values for everything and giving them explicit types, which is essentially the equivalent of just using inference here. Thus in this case inference isn't doing anything negative because the code would look like that regardless.