type checking

Posted on 2012-09-16
Last Modified: 2012-10-05
In C/Java
int abc;
helps compiler to
1) conclude  invalid operations on abc
2) memory allocation to abc

But what about scheme interpreter or lisp compiler?
How do they decide?

Question by:mohet01
    LVL 26

    Accepted Solution

    You might get more answers if you asked about javascript, which is also a loosely typed interpretive language.  The grammar is less strong, though, so it's probably good to use scheme and lisp as examples.

    C and Java are strongly typed languages, which as you noted helps with the compiler (and runtime), for performance and for more intangible things like the ability of programmers to effectively write and maintain code.

    It can be very helpful not to have strong typing, though, hence the more interpretive languages.  Interpretive languages still work with the same math and hardware, so at some point they try to multiply numbers or concatenate strings.  In general, loosely typed languages try to do as much as possible without caring about the type of the variable (which is generally a lot).  Then they usually examine the variable value to determine the type if it cannot be determined from other information.  The operations being performed, for example, would usually determine the expected type of the variable, and if the variable value turned out not to be that type, then some sort of error condition should occur.  In the early days that was often a memory fault, or an error much further down in the code, but nowadays even loosely typed languages catch these sorts of errors and attempt to fail in a useful way.

    You should check some computer science textbooks on compilers to fully answer your question.  Wikipedia has a nice, short article on variables:

    Author Closing Comment


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
    Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
    The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now