[Compiler-sig] Lvalue
Finn Bock
bckfnn@worldonline.dk
Sat, 13 Apr 2002 13:01:58 GMT
[Jeremy]
>The Lvalue node captures the notion that a limited subset of
>expressions can occur in two contexts -- as an expression or as the
>target of an assignment.
Ok, but is it important to express that notion in the AST typesystem?
I'm sure you have given this more though than I have, but I tend to
disagree. Maybe it is just that I loath to see AST like:
: Expr[value=Lvalue[lvalue=Attribute[value=Lvalue[lvalue=Name[id=A]], attr=b]]]
to capture the expression "A.b".
I would prefer an asdl without the "assign" type and instead:
| Del(expr* targets)
| Assign(expr* targets, expr value)
| AugAssign(expr target, operator op, expr value)
Yes, I know that would allow a user to manually create an semanticly
incorrect AST tree, but IMO that is what TypeErrors are good at
expressing.
Just my 2 cent.
regards,
finn