3 ms·
> Type inference works only when the types are unambiguous It looks to me like when the types are ambiguous (because nothing placed a restriction on them), int
by xscott 6y ago
> Type inference works only when the types are unambiguous
It looks to me like when the types are ambiguous (because nothing placed a restriction on them), integer literals become 32 bit and floating literals become 64 bit. Then quietly, later when you add a restriction, the code above (which you've already worked through one line at a time with debug statements and all) changes from underneath you.
> You can still declare types ahead of time if you want to.
When the implicit stuff is surprising, I'd rather it wasn't ever implicit.