Re: Immutable nested functions

2011-01-08 Thread Tomek Sowiński
Robert Jacques napisał: > >> 3. (vaguely related) Should there be means to express annotated > >> delegates in general (e.g. pure, nothrow). > > > > There is. > > int delegate(int) pure square > > = cast( int delegate(int z) pure ) > > (int z) { return z*z; }; > >

Re: Immutable nested functions

2011-01-07 Thread Robert Jacques
On Fri, 07 Jan 2011 17:18:39 -0500, Don wrote: Tomek Sowin'ski wrote: A while ago I pointed out that the result of an immutably pure function (all arguments immutable, doesn't mutate globals) can be safely converted to immutable. More here: http://d.puremagic.com/issues/show_bug.cgi?id=508

Re: Immutable nested functions

2011-01-07 Thread Don
Tomek Sowin'ski wrote: A while ago I pointed out that the result of an immutably pure function (all arguments immutable, doesn't mutate globals) can be safely converted to immutable. More here: http://d.puremagic.com/issues/show_bug.cgi?id=5081 It helps with building complex immutable structur

Re: Immutable nested functions

2011-01-07 Thread Tomek Sowiński
gt; if EVERY variable in the enclosing stack frame is immutable? Good point. I think the concept of immutable nested functions is still a solid improvement, even with requiring every variable of the enclosing stack frame to be immutable. > Is there any reason you couldn't just use static n

Re: Immutable nested functions

2011-01-06 Thread Daniel Murphy
"Tomek Sowinski" wrote in message news:20110104222343.4...@unknown... > Nested functions to be immutably pure must also guarantee that nothing > gets mutated through its stack frame pointer. But there's a problem -- the > compiler won't accept 'immutable' on a nested function. I think it >

Re: Immutable nested functions

2011-01-06 Thread Tomek Sowiński
Tomek Sowiński napisał: > [snip] Two days, no answer. I was told that silence means agreement on this NG but this is extreme ;-) Seriously, what did I do wrong? Too long/boring post? -- Tomek

Immutable nested functions

2011-01-04 Thread Tomek Sowiński
A while ago I pointed out that the result of an immutably pure function (all arguments immutable, doesn't mutate globals) can be safely converted to immutable. More here: http://d.puremagic.com/issues/show_bug.cgi?id=5081 It helps with building complex immutable structures. Problem is, virtually