What are pure variables?

466 Views Asked by At

I was surprised to find that this code compiles:

pure string Foo = SomePureFunction(123);

pure is only mentioned in the context of functions in the online documentation.

What are pure variables, and how are they different from immutable and const ones?

1

There are 1 best solutions below

4
On BEST ANSWER

The attribute just has no effect in this case. It's a known issue in DMD, there are quite a number other similar cases, where attributes are not rejected, but don't have any effect as well.