Search code examples
interpretercompiled

What is the advantages an interpreted language has over a compiled language?


Possible Duplicate:
What’s with the love of dynamic Languages

I have already read this, but I do not get it.

What use is making your own interpreter. Also, it says platform independence. After all the degree of platform independence is limited by what all platforms your interpreter can run on. So, I don't see any advantage.

Also, I dont know even one good use of dynamic typing. It is useless I feel. Ofcourse, I am wrong, because there are so many dynamically typed languages out there.

Can somebody help me out here? thanks.


Solution

  • Dynamic languages are very very convenient for simple things. Lets say you want to write a small program that will diff between two files. In python what you do is:

    file1 = open(<filename>)
    file1.read()
    file1.split('\n')
    #same for file2
    for line in file1:
        if line not in file2:
             print line
    

    so file1 will start off as a FD. Then it turns to a string. And finally a list. The same 9-code program will take at least twice as much rows on java.

    The trouble starts when you want to write very large programs and work in a team. Managing APIs and interfaces is much easier in java.