On 9/23/10 15:25 CDT, Don wrote:
Steven Schveighoffer wrote:
On Thu, 23 Sep 2010 08:47:36 -0400, Robert Jacques <sandf...@jhu.edu>
wrote:

On Thu, 23 Sep 2010 02:51:28 -0400, Don <nos...@nospam.com> wrote:

Jesse Phillips wrote:
Steven Schveighoffer Wrote:
If we can define weakly pure functions this way, they most likely
will be way more common than unpure functions. I know I avoid
accessing global variables in most of my functions. Think about a
range, almost all the methods in a range can be weakly pure. So
that means you need to mark every function as pure.

I think that's true. I/O is impure, but most other things are not.

The GC also impure :)

The GC must be assumed to be pure even though it's not. Otherwise,
pure functions can't do any heap allocation, and that makes them
pretty useless in a garbage collected languages.

In functional languages, allocating memory is usually considered pure.

In the D spec, it already says that 'new' is considered pure.

Which is wrong :o(. new invokes the constructor, which may do a variety of impure things.

Andrei

Reply via email to