Re: merits of Lisp vs Python
greg <greg@cosc.cant erbury.ac.nzwri tes:
>
I'm not saying that it's impossible to compile
Python, only that's there's a lot more to it than
just macro expansion. The OP was saying something
like "If you added macros, you might get a compiler
for free", which is clearly far from true.
Yeah, my mistake - I simply glided right past the "just by macro
expansion." Oops. :)
>
Please correct me if I'm wrong, but as I understand,
getting efficient code out of a Lisp compiler requires
putting type declarations into the source.
>
If you put the same declarations into a piece of
Python code, then of course it would be fairly
straightforward to compile it efficiently. But it
wouldn't really be dynamic Python any more.
Type declarations can squeeze out extra efficiency, but vanilla Lisp
without type declarations will still beat Python, both because the
language is designed to compile well and because compilers for Lisp
are generally very mature. So it is not the case that type
declarations are the only thing that make Lisp efficient.
greg <greg@cosc.cant erbury.ac.nzwri tes:
>A compiler shifts a lot of decisions that an
>interpreter would have to make at runtime to compile-time. There is
>no reason a dynamic language can't enjoy this efficiency.
>interpreter would have to make at runtime to compile-time. There is
>no reason a dynamic language can't enjoy this efficiency.
I'm not saying that it's impossible to compile
Python, only that's there's a lot more to it than
just macro expansion. The OP was saying something
like "If you added macros, you might get a compiler
for free", which is clearly far from true.
expansion." Oops. :)
>Despite its dynamism, Lisp is quite compilable.
Please correct me if I'm wrong, but as I understand,
getting efficient code out of a Lisp compiler requires
putting type declarations into the source.
>
If you put the same declarations into a piece of
Python code, then of course it would be fairly
straightforward to compile it efficiently. But it
wouldn't really be dynamic Python any more.
without type declarations will still beat Python, both because the
language is designed to compile well and because compilers for Lisp
are generally very mature. So it is not the case that type
declarations are the only thing that make Lisp efficient.
Comment