On 2012-04-21 14:22:41 +0000, [email protected] (Christophe) said:
This scope system is very similar to the mutable/immutable system. It is optionnal (one may code without it). There is transitivity, a bridge type (const or scope(in)), and also the same virality (is this an english word??). This means that to be usable, this system requires to restrict the usage of parameters and returned value of the functions by appropriate keywords (scope(in, out or inout), otherwise a scoped variable can't be passed to a function and is not usable in practice. But in my opinion, the gain is very large. When used, variable lifetimes becomes deterministic, the compiler can destroy them at the right time, and use the GC only when necessary, or with global variables.
I fear your solution might not be complicated enough (!) to allow some common patterns. One simple case that often challenges such proposals is the swap function.
So with your system, how do you write the swap function? -- Michel Fortin [email protected] http://michelf.com/
