Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95854

Re: Why Python is not both an interpreter and a compiler?

From Jussi Piitulainen <harvesting@makes.address.invalid>
Newsgroups comp.lang.python
Subject Re: Why Python is not both an interpreter and a compiler?
Date 2015-09-02 08:59 +0300
Organization A noiseless patient Spider
Message-ID <lf5r3mh2wf7.fsf@ling.helsinki.fi> (permalink)
References (2 earlier) <87twrftw4w.fsf@elektro.pacujo.net> <a1dc8c59-e5a8-4672-afde-49416bbee76a@googlegroups.com> <55e5c220$0$1641$c3e8da3$5496439d@news.astraweb.com> <87io7uun4s.fsf@elektro.pacujo.net> <55e663b5$0$1668$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


Steven D'Aprano writes:
> On Wed, 2 Sep 2015 02:20 am, Marko Rauhamaa wrote:
>> Steven D'Aprano:
>> 
>>> I believe that Marko is wrong. It is not so easy to compile Python
>>> to machine language for real machines. That's why the compiler
>>> targets a virtual machine instead.
>> 
>> Somehow Guile manages it even though Scheme is at least as dynamic a
>> language as Python.
>
> It's not about the dynamicism precisely, it's about what counts as
> primitive data types and operations.
>
> What are the primitives in Scheme? In Python, the primitives are
> pretty complex. I don't know how accurate this page is:
>
> https://en.wikibooks.org/wiki/Scheme_Programming/Scheme_Datatypes
>
> but it suggests that Scheme primitives are quite close to the
> machine. That may keep the runtime small.

I think I spotted a tiny inaccuracy, but the real problem with that page
is that it's *very* incomplete: no mention of exact integers and
rationals, strings appear in text but not as an entry, were vectors even
mentioned?, nothing about procedures!, let alone reified continuations,
nothing about input/output ports. Also records (definable types with
named fields) are now officially in for some time already, so that's
another kind of structured types. Many implementations have object
systems, possibly modules as objects.

It's quite analogous to Python's objects.

Eval in Scheme is more restricted. Procedure internals are not
accessible at all, and implementations typically offer ways to declare
that standard names in a compilation unit indeed have their standard
meaning and variables will not be assigned outside the given compilation
unit, so the compiler can propagate information about expected argument
types around, infer more types, inline code, and lot's of things that
are way beyond me.

Some Scheme implementations use quite aggressive compilation techniques.
Guile is one, I think. Gambit and Larceny are two others.

[- -]

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why Python is not both an interpreter and a compiler? Mahan Marwat <mahanmarwat@gmail.com> - 2015-08-31 01:35 -0700
  Re: Why Python is not both an interpreter and a compiler? Chris Angelico <rosuav@gmail.com> - 2015-08-31 18:49 +1000
  Re: Why Python is not both an interpreter and a compiler? Cameron Simpson <cs@zip.com.au> - 2015-08-31 19:59 +1000
  Re: Why Python is not both an interpreter and a compiler? Ben Finney <ben+python@benfinney.id.au> - 2015-08-31 21:41 +1000
    Re: Why Python is not both an interpreter and a compiler? Marko Rauhamaa <marko@pacujo.net> - 2015-08-31 16:39 +0300
      Re: Why Python is not both an interpreter and a compiler? Mahan Marwat <mahanmarwat@gmail.com> - 2015-08-31 10:48 -0700
        Re: Why Python is not both an interpreter and a compiler? Emile van Sebille <emile@fenx.com> - 2015-08-31 10:56 -0700
        Re: Why Python is not both an interpreter and a compiler? Ben Finney <ben+python@benfinney.id.au> - 2015-09-01 09:15 +1000
        Re: Why Python is not both an interpreter and a compiler? Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-09-01 07:45 +0200
          Re: Why Python is not both an interpreter and a compiler? Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-01 11:21 -0600
        Re: Why Python is not both an interpreter and a compiler? Laura Creighton <lac@openend.se> - 2015-09-01 09:51 +0200
        Re: Why Python is not both an interpreter and a compiler? Steven D'Aprano <steve@pearwood.info> - 2015-09-02 01:20 +1000
          Re: Why Python is not both an interpreter and a compiler? Marko Rauhamaa <marko@pacujo.net> - 2015-09-01 19:20 +0300
            Re: Why Python is not both an interpreter and a compiler? Chris Angelico <rosuav@gmail.com> - 2015-09-02 03:06 +1000
            Re: Why Python is not both an interpreter and a compiler? Laura Creighton <lac@openend.se> - 2015-09-01 19:33 +0200
              Re: Why Python is not both an interpreter and a compiler? Marko Rauhamaa <marko@pacujo.net> - 2015-09-01 23:08 +0300
                Re: Why Python is not both an interpreter and a compiler? Chris Angelico <rosuav@gmail.com> - 2015-09-02 10:50 +1000
                Re: Why Python is not both an interpreter and a compiler? Laura Creighton <lac@openend.se> - 2015-09-02 09:09 +0200
                Re: Why Python is not both an interpreter and a compiler? wxjmfauth@gmail.com - 2015-09-02 01:25 -0700
            Re: Why Python is not both an interpreter and a compiler? Laura Creighton <lac@openend.se> - 2015-09-01 19:52 +0200
            Re: Why Python is not both an interpreter and a compiler? Steven D'Aprano <steve@pearwood.info> - 2015-09-02 12:49 +1000
              Re: Why Python is not both an interpreter and a compiler? Marko Rauhamaa <marko@pacujo.net> - 2015-09-02 06:58 +0300
              Re: Why Python is not both an interpreter and a compiler? Jussi Piitulainen <harvesting@makes.address.invalid> - 2015-09-02 08:59 +0300
  Re: Why Python is not both an interpreter and a compiler? Michael Torrie <torriem@gmail.com> - 2015-09-01 21:46 -0600

csiph-web