Ian Bicking <ianb <at> colorstudy.com> writes:
> > As a hypothetical example, supposed we defined a unary operator '?' such that: > > > > ?x > > > > was syntactic sugar for: > > > > quoted('x') > > > > or even: > > > > quoted('x', (scope where x is or would be defined) ) > > > > Where 'quoted' was some sort of class that behaved like a reference to a > > variable. So ?x.set( 1 ) is the same as x = 1. > > Sounds like lambda x: ... More differences than similarities, I think. For one thing, you can't use lambda x: ... to assign to x. And while you could possibly overload the arithmetic operators on a lambda, you'd have to do it for each lambda individually, since lambdas don't have classes. > > Moreover, you would want to customize all of the operators on quoted to return > > an AST, so that: > > > > ?x + 1 > > > > produces something like: > > > > (add, quoted('x'), 1) > > > > ...or whatever data structure is convenient. > > You can match the free variables from the lambda arguments against the > variables in the AST to get this same info. I don't understand what this means. Look, folks, I don't have a concrete proposal here. I'm actually fishing for ideas, not looking to have my own ideas validated (or not.) My gut tells me that there's something here worth looking into, but I haven't put my finger on it yet. (Isn't it interesting how often we programmers, who pride ourselves on our use of logic and reason, so often use intuition and hunches to solve problems?) -- Talin _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com