logoalt Hacker News

fuzzy2today at 9:36 AM2 repliesview on HN

Inferred types are really great, but I feel they do not scale. Inside a method/function? Generally fine, but the signature, including the return type, had better be explicit.

Also, I think there was some performance issue with too much inference? Could be wrong, could also be fixed.


Replies

g947otoday at 11:20 AM

This. As soon as you need to use the type in another function (e.g. function parameter), you'll discover that it's better to just write it out.

epolanskitoday at 11:29 AM

They do scale, but explicit types have two bonuses in my eyes:

1. can be read without a compiler, useful when reading PRs

2. They make the compiler work less, it's easier to check than infer