[Issue 7432] DMD allows variables to be declared as pure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 18 17:17:34 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=7432



--- Comment #13 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-08-18 17:17:33 PDT ---
> You're talking about what the compiler actually does, which is a different
> matter from what the spec indicates it should do.

Honestly, it really doesn't matter what the spec says. In general, if there's a
disagreement between the spec and the compiler, the spec loses. The spec and
the compiler should be in agreement, but the fact that the spec says something
doesn't necessarily mean much. The spec is generally written after the fact to
match the compiler rather than the compiler being written to match the spec.
So, yes, the situation there needs to be improved, but complaining that the
compiler is wrong because it doesn't match the spec will likely get you
nowhere.

> Indeed, the point of pure seems to be to indicate that something is suitable
> for use within a purely functional programming paradigm.  So unless we make
> pure equivalent to immutable when applied to variables....

pure makes no sense whatsoever on variables. Neither do @safe, @trusted, or
nothrow. The fact that you can at least sometimes marks variables that way is a
side effect of the fact that the compiler tends to ignore invalid attributes. I
really don't think that we should even consider making it so that any of those
make sense on variables. All we should be doing is determining where the
compiler should ignore invalid attributes and where it should give an error,
and then we need to make sure that both the spec and the compiler agree.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list