3 ms·
You can, but you may start to run into some limitations. Many languages have some version of type inference, which allows them to figure out the type of a thing
by actsasbuffoon 9y ago
You can, but you may start to run into some limitations. Many languages have some version of type inference, which allows them to figure out the type of a thing, even though the programmer didn’t specify it.
C# has a very weak version of this with the auto keyword. Languages like Crystal take it much further by tracing the flow of data through the entire program. It generally works quite well, though there are a few edgecases that require explicit type annotations.
As for auto-completion, some languages feature designs that make it easy to offer auto completion even without type information. For instance, Elixir doesn’t have methods. You only have functions defined on modules, and it’s trivially easy to know what functions are defined on a module.
So it’s possible, but there are some limitations.
- TheDong 9y agoType inference goes hand-in-hand with static typing. Those are not opposite things. > C# .... Crystal Both are fully statically typed languages with type inference. Those are unrelated to the argument the parent comment is making.
- jaggederest 9y agoThey still both allow generic arguments, in reduction, this means that they still have uncertainty. I can and have built a totally untyped language within a fully statically typed language - nostrademons' Scheme-in-haskell exercise is a lot of fun. You just have to define a Universal type and then back out of all that nasty compile-time nonsense. Everything is Univ and Univ is everything.
- andybak 9y ago> Type inference goes hand-in-hand with static typing. That would imply there's no type inference possible with dynamic languages - either at "compile" time or run time. (Wouldn't it also imply that static typing and strong typing are synonymous?)