Idea: partially pure functions

Simen Kjaeraas simen.kjaras at gmail.com
Fri Aug 1 10:24:08 PDT 2008


On Fri, 01 Aug 2008 03:46:30 +0200, mort <mortm at gmail.com> wrote:

> - Pure functions can't be applied to mutable data.  So you potentially  
> need a mutable non-pure version of each pure function.

I would believe the following to work:

pure SomeStruct foo(invariant SomeStruct f);

foreach (ref s; SomeStructArray)
	s = foo(cast(invariant)s);

-- 
Simen



More information about the Digitalmars-d mailing list