Pure doesn't consider shared variables accessed by other threads.
In this sense m_fill is like a global variable even though local to the circular buffer struct and the implicit this parameter.
struct SCircularBuffer
{
shared ℕ m_fill = 0;
@property ℕ availableBytesForReading() const pure nothrow
{
return atomicLoad(m_fill);
}
}
Comment #1 by yebblies — 2013-11-21T04:30:14Z
And global variable can be read inside pure functions if they are accessible through a parameter.