Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7891865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:43:34+00:00 2026-06-03T06:43:34+00:00

As far as I know,any programming language which doesn’t require to write type annotations

  • 0

As far as I know,any programming language which doesn’t require to write type annotations in the source while writing a function or module and if that chunk of code is “type-correct” , compiler will infer the types and compiles the code. is there more to it?

is(are) there a such language(s)? if yes are there any limitations on it’s type system?

Update 1:
Just to be really clear , I am asking about a statically typed,fully type-inferred programming language not a dynamically typed programming language.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:43:35+00:00Added an answer on June 3, 2026 at 6:43 am

    The limitation of full type inference is that it doesn’t work with many advanced type system features. As an example consider Haskell and OCaml. Both of these languages are almost fully type inferred, but have some features that can interfere with type inference.


    In Haskell it’s type classes combined with polymorphic return types:

    readAndPrint str = print (read "asd")
    

    Here read is a function of type Read a => String -> a, which means “for any type a that supports the type class Read the function read can take a String and return an a. So if f is a method that takes an int, I can write f (read "123") and it will convert “123” to the Int 123 and call f with it. It knows that it should convert the string to an Int because f takes an Int. If f took a list of ints, it would try to convert the string to a list of Ints instead. No problem.

    But for the readAndPrint function above that approach does not work. The problem here is that print can take an argument of any type that can be printed (that is any type that supports the Show typeclass). So there’s no way for the compiler to know whether you want to convert the string to an int, or a list of ints, or anything else that can be printed. So in cases like this you need to add type annotations.


    In OCaml the problematic feature is polymorphic functions in classes: If you define a function that takes an object as its argument and calls a method on that object, the compiler will infer a monomorphic type for that method. For example:

    let f obj = obj#meth 23 + obj#meth 42
    

    Here the compiler will infer that obj must be an instance of a class that has a method named meth of type int -> int, i.e. a method that takes an Int and returns an Int. You can now define a bunch of classes that have such a method and pass instances of that class as arguments to f. No problem.

    The problem occurs if you define a class with a method of type 'a. 'a -> int, i.e. a method that can take an argument of any type and return an int. You can not pass an object of that class as an argument to f because it doesn’t match the inferred type. If you want f to take such an object as its argument, the only way is to add a type annotation to f.


    So those were examples of languages that are almost fully type inferred and of cases where they’re not. If you’d remove the problematic features from those languages, they’d be fully type inferred.

    Consequently basic dialects of ML without such advanced features are fully type inferred. For instance I assume that Caml Light is fully type inferred since it’s basically OCaml without classes (however I don’t actually know the language, so that’s just an assumption).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In any programming language, I can trace any function and know which function is
I'm new to doing anything with any language that isn't english. So far the
As far as know, I must be careful with PHP, and I think Javascript.
As far as i know, there is no direct equivalent in C#. My current
As far as I know, only the convenience methods return created objects with an
so far i only know to use Ctrl-Shift-A to do SVN in TextMate. is
As far as I know there is no way to do this, but I
As far as I know, ASP.NET MVC leverages a lot of the features of
As far as I know document.getElementById('myId') will only look for HTML elements that are
As far as i know, the result of [a, A].uniq is [a, A] My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.