Function parameter inference would have been dope.
-
Function parameter inference would have been dope.
Imagine having to only write:
```
function foo(a) {
// ...
}
```But the compiler would have been able to infer the type of `foo`, and thew an error if the wrong type were to be passed to `foo`.
It would have heavily leveraged the idea of interface segregation principle, where all we care about is the interface, rather than the implementation.
-
@manlycoffee I would avoid this language. The code would be hard to support and even harder to review.
-
First part: I don't see how it would it be hard to support
The second part: you may be right about the code review. That said, I'd imagine at least the CI pipeline would block all merge
-
@manlycoffee The same way it's harder to maintain projects in languages that already let you avoid writing types here and there.
E.g. in Kotlin you can write
var foo = bar()
It looks ok until the point when I need to know the type of foo, that usually costs a couple of extra moves. Then add extra complexity by not defining types in function signatures, add automatic casting, deep call stack, and at some point you can get lost, because you wanted your code to look cute. -
@Anibyl I guess there's a reliance on an IDE; otherwise, we're hooped when looking at the plain text.