On 2011-01-17, John Nagle <na...@animats.com> wrote: > That's been done once or twice. There's what are called "single > assignment languages". Each variable can only be assigned once. > The result looks like an imperative language but works like a functional > language. Look up "SISAL" for an example. This approach is good > for concurrency and optimization, but it never caught on.
That is rather interesting; especially since most of the current hype is about immutability and the lack of side affects of functional languages rather then functional decomposition using lamda calculus constructs. > Note that from a concurrency standpoint, immutability is very > useful. It's a lot like single assignment. You can pass around > immutable objects to concurrent threads without race conditions, > provided that memory management can handle concurrency. This works I wonder if even that is fully necessary. In, Ada procedure arguments specify whether or not they can be changed within the procedure effectively creating a gateway whereby side affects can be specified. If you take that a step further and require: 1. The function of a scope is completely closed. It cannot access anything from the scope above it except what is passed to it as arguments. 2. Arguments that can be changed must be copied on write so that they don't directly affect the memory of the outer scope. Then you can be sure that the functions have no side affects outside of the values that they return. Internally, the function can use imperative semantics that require mutability such as iteration instead recursion without affecting anything above it. -- http://mail.python.org/mailman/listinfo/python-list