[racket] Python versus Racket

From: Konrad Hinsen (konrad.hinsen at fastmail.net)
Date: Thu May 15 04:18:00 EDT 2014

Eduardo Costa writes:

 > I wonder whether a more restricted form of Python would not be
 > acceptable in situations where speed is critical. I mean, instead
 > of cl-python, that tries to mimic the semantic of Python closely,
 > the Lisp community could write a compiler for the subset of Python
 > that the majority of people really use. This subset of Python would
 > share the semantic of Lisp.

The main question is: for which use cases would that be a good idea?
If you want to use existing Python libraries, you need exact Python
semantics. If you don't, defining a new language with a different name
creates less confusion than creating almost-Python.

What can be done, however, is optimization for the frequent cases with
a fallback to the general case. Check out the proceedings of the
European Lisp Symposium 2014, it contains a description of an
implementation of Python in Racket that follows this approach.

 > I believe that the strategy of specialised  operators adopted in
 > Scheme and Racket could be useful for Python too. I mean, operators
 > like fx+, fl+, fl*, etc could help the compiler infer the type of

True, but if you care about infix notation for maths, it is very
difficult to introduce specialized operators and get people to use
them.

Konrad


Posted on the users mailing list.