Reputation: 11187
I know of languages like Haskell being statically typed and having type inference. But are there non-functional languages that have global type inference, the equivalent of something like C with type inference and structural typing.
Upvotes: 4
Views: 1047
Reputation: 73163
OCaml is the only one I know which can be imperative/object-oriented that is statically typed, garbage collected and supports global type inference and structural typing, though it is essentially a functional language.
Scala isn't a functional language like OCaml but an imperative/object-oriented language that supports structural typing, but does not have the kind of type inference you're looking for. It still supports functional constructs, though.
If by "non-functional" you mean a language that doesn't support functional programming at all, then I don't think there is one.
Upvotes: 1
Reputation: 7919
There's also Crystal, but it's in pre-alpha stage:
https://github.com/manastech/crystal
Upvotes: 0
Reputation: 914
OCaml isn't the only contender anymore. A number of structurally-typed imperative languages have appeared in recent years:
Upvotes: 2