pure or not pure?

Janice Caron caron800 at googlemail.com
Thu Apr 10 06:51:56 PDT 2008


On 10/04/2008, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>  But if I can't declare it as 'pure', then I can't
>  call it from f and g:

No, you can't.


>  So should there be a way to define createIncreasingSequence such that I can
>  call it from a pure function?

I would say no.


>  Or do I have to re-implement it in every pure
>  function I use?

You can make a pure function to return an immutable array, and then
duplicate it within f and g.


>  Not having the ability to pass around mutable heap data to and from pure
>  functions is going to limit severely the usefulness of pure functions.

I don't see why. Functional programming languages such as Haskell seem
not to mind. In many functional programming languages, there is no
mutable data at all.



More information about the Digitalmars-d mailing list