Steven D'Aprano <st...@remove-this-cybersource.com.au> writes:

> On Thu, 18 Nov 2010 14:21:47 +0000, Martin Gregorie wrote:
>
> > I use 'script' to refer to programs written in languages that don't have
> > a separate compile phase which must be run before the program can be
> > executed. IOW Python and Perl programs are scripts aloing with programs
> > written as awk, Javascript and bash scripts.
>
> You're mistaken then about Python, because it does have a separate 
> compilation phase that runs before the program can be executed. Where do 
> you think the .pyc files come from, and what did you think the compile() 
> function did? It just happens automatically, rather than manually.

I think Martin meant that there's no /explicit/ compilation phase.  As a
case in point, tcc is an optimizing native-code compiler for C which is
so fast at generating code that it has a mode which accepts an initial
`#!' line in its input; the documentation refers to C `scripts'.

Awk, Javascript and Perl have full compilation phases too, but they're
hidden from the user; bash certainly builds a parse tree but I don't
know whether it just walks that or has some other kind of internal
representation.

> Maybe, once upon a time, there was a meaningful distinction to be made 
> between purely interpreted languages and purely compiled languages.

No, there never was; only between interpreting and compiling
implementations.


> But today, when "interpreted" languages have a compilation phase, and
> "compiled" languages have the equivalent of eval() and do their
> compilation at runtime, such a distinction is now fairly arbitrary.
> Better questions are:
>
> * Does the program compile to native machine code or byte code?
>
> * How efficient is the machine code, or the virtual machine that executes 
> the byte code? What do you mean by "efficient"?
>
> * Is there an integrated parse-compile-execute cycle, or does the 
> developer have to perform them individually?
>
> * To what degree is the syntax of the language aimed at rapid development 
> and/or runtime efficiency?
>
> Harder questions to ask, and answer, than "Is that language for writing 
> scripts or programs or applications?", but the answers are far more 
> meaningful.

Maybe.  I note that there are Lisp systems (plural!) which compile to
native code (only -- with no interpreter at all), but fully support
runtime `eval', batch compilation of source files, aggressive
optimization for speed and/or space, and so on.  So I think that some of
the above questions, at least, present false dichotomies: one doesn't
have to choose one or the other; one can have cake and eat it too.

Also some of the questions are about the language and some are about the
implementation.  It's important not to get the two confused.

-- [mdw]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to