views:

318

answers:

7

Hello,

I'm now learning Perl, but what are the pros and the cons of the interpreted languages?, because i started to learn Perl because my friend started, then it's only more one language to my experience. Thanks.

+1  A: 

Con:

  • The biggest drawback is probably execution speed

Pro:

  • The biggest upside is probably turn-around time i.e. code-test iteration loop
jldupont
+4  A: 

Pros:

  • Rapid prototyping (no write, compile, execute cycle)
  • Cross-platform (assuming interpreters exist for each platform)

Cons:

  • Performance (won't be as fast as compiled languages)
t_scho
C/C++ can be arguably cross-platform ;-)
jldupont
I develop in C++ and it's very much cross-platform.
Nathan Campos
I'm not saying non-interpreted languages aren't cross-platform, I'm just saying that is a positive attribute common to interpreted languages :)
t_scho
+1  A: 

To put for the obvious and broad point, compiled languages tend to have higher performance than interpreted ones, since compiling precludes the need for a runtime interpreter.

Compiled languages are more suitable for commercial desktop software, since the source code is not shipped along with it.

Interpreted languages tend to be a bit quicker to learn, insofar as they allow you to quickly edit/run/repeat without waiting on a compiler. In my experience they also tend to be higher-level, which makes them easier as well.

Adam Bard
+2  A: 

Biggest drawback? Most would say execution speed, but isn't always necessarily true. Most modern interpreted languages these days convert the files to be interpreted into an intermediate state upon building, which when executed is turned into bytecode just as any other language. With bytecode caching being mostly prevalent these days, it shouldn't be too much of an issue. This is certainly not to say that performance is not an issue with interpreted languages, just that it is often not as bad as most would suggest.

Keep in mind that even with the performance problems though, it is often easier to achieve the same tasks as a compiled language in less and more efficient code, making the performance loss during compilation negligible over the execution time of a program.

Personally for me, the biggest drawback is the need for the interpreter to always be present before execution can occur. This quite often reduces portability, especially because interpreted languages aren't always cross platform.

Nathan Kleyn
+3  A: 

Blatant copy from wikipedia so I'll make this community wiki.

Advantages of interpreted languages

Interpreted languages give programs certain extra flexibility over compiled languages. Features that are easier to implement in interpreters than in compilers include (but are not limited to):

  • platform independence (Java's byte code, for example)
  • reflection and reflective usage of the evaluator (e.g. a first-order eval function)
  • dynamic typing
  • ease of debugging (it is easier to get source code information in interpreted languages)
  • small program size (since interpreted languages have flexibility to choose instruction code)
  • dynamic scoping
  • automatic memory management

Disadvantages of interpreted languages

An execution by an interpreter is usually much less efficient then regular program execution. It happens because either every instruction should pass an interpretation at runtime or as in newer implementations, the code has to be compiled to an intermediate representation before every execution. The virtual machine is a partial solution to the performance issue as the defined intermediate-language is much closer to machine language and thus easier to be translated at run-time. Another disadvantage is the need of an interpreter on the local machine to make the execution possible.

Nifle
A: 

Wikipedia has a page on the advantages and disadvantages. Any significantly advanced interpreted language can be actual compiled into a native binary thus blurring the lines between the pro's and cons of an interpreted language.

PERL is one of those languages which blurs the lines. Whilst its famous for being a powerful scripting language, you could compile it to be native.

Andrew Keith
A: 

The "slowness" of Dynamic Languages such as PERL may not be an issue any longer. Here is an excellent presentation on the latest trends in the Dynamic Language area:

http://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-back.html

srini.venigalla