Techopedia explains Type InferenceType inference is often a compiler feature of functional programming languages rather than of object-oriented ones. The compiler or interpreter needs only minimal information as well as context in order to figure out what the data type of a variable or expression is.
The inference algorithm tries to determine the argument types as well as the return value type and then it tries to find the most specific data type that works with all of the arguments. As a basic example, consider the function Foo(a,b) = x + y; the compiler knows that the "+" operator takes two integers and also returns an integer, so now the compiler or interpreter can infer that Foo also has the type integer.
Survey: Why Is There Still a Gender Gap in Tech?
Do you work in the tech industry? Help us learn more about why the gender gap still exists in tech by taking this quick survey! Survey respondents will also be entered to win a $100 Amazon Gift Card!
- Scripting Languages 101
- Computer Programming: From Machine Language to Artificial Intelligence
- The Pioneers of Computer Programming
- Data Breach Notification: The Legal and Regulatory Environment
- Artificial Intelligence in Cybersecurity
- The Differences Between the Top 3 Cryptocurrencies