Abstract and concrete syntax

David Baelde david.baelde at ens-lyon.fr
Fri Jun 10 16:11:47 EDT 2005


> For instance, if assignment were done in an expression, the targets would 
> have to be quoted to avoid having them evaluated.  Or the assignment 
> expression would have to be a 'special expression' that did not evaluate 
> all its terms (like setq in some (just older?) lisps).  In Python, that 
> 'special expression', with its 'quote, don't evaluate, targets' rule, is a 
> statement!

That's not such a big issue, many languages solve that without quoting.
Ruby, for example. I agree that there's a point here. But nothing to do
with quoting.

You refer to Lisp, here's how things work in Caml: standard variables
cannot be assigned, only defined with [let x = v in ...]. But you can
create references, which can be assigned. When you wanna get the value of
a ref you use [!x], if you wanna set it, use [x := ...]. It allows you to
write [(if test then x else y) := ...], which is actually rarely needed.
Thus, making implicit the ! everywhere except before := is acceptable. And
you get the usual behavior with python. Finally, you just have to choose
the value of [x = v], maybe [v], maybe [None].

__
David




More information about the Python-list mailing list