Reputation:
I've got few questions about Type Inference languages. By saying type inference, I refer to all those languages where the datatype need not be explicitly declared in code.
I think these languages give greater flexibility to developers, but I would like to have answers for the below questions.
Do these languages consume more time at runtime to infer the actual data types?
Can these languages be used for development of enterprise applications? Do they support maintainability and reusability?
Upvotes: 0
Views: 62
Reputation: 244757
Do these languages consume more time at runtime to infer the actual data types?
Many languages with type inference use a compiler. The compiler does all the work required for type inference, so there is no runtime cost.
Can these languages be used for development of enterprise applications?
You're asking if a large, varied group of languages can be used for a large, varied domain. I don't think asking that question makes much sense. But generally speaking, yes, languages with type inference can be used to develop enterprise applications.
Do they support maintainability and reusability?
That's a very nebulous question. I'd say that you can write manitainable and reusable code in any mainstream language, including those with type inference.
Upvotes: 0
Reputation: 370082
First of all let's clarify some terminology:
So when we talk about languages that don't require explicit type annotations, there are basically two categories:
Dynamically typed languages generally require additional type checks at runtime and have less room for optimizations (because optimizers can optimize more things when they know the types). So there's some performance drawbacks to dynamic typing. However it is possible, depending on the language, to compensate for some of this by applying type inference to figure out the types statically where possible. There certainly are enterprise applications written in dynamically typed languages.
Statically typed languages with type inference don't perform any differently at runtime than statically typed languages without them. Only the compile times may be longer.
Upvotes: 1