On Monday, 28 July 2014 at 06:27:44 UTC, Vlad Levenfeld wrote:
A weird thing happened:
I was building a dictionary struct which contains a custom
array of values and a differently-typed custom array of keys.
Both of them implicitly define "clear" by aliasing a backing
array.
The dictionary type doesn't have clear, though. And it doesn't
alias anything. Yet when I call clear on it, not only does it
work, but it clears both of the private contained arrays. I
can't find any free clear function in Phobos.
Not that I'm complaining, but... what's going on here?
I'm not sure, but is your code calling the runtime `clear`
method:
https://github.com/D-Programming-Language/druntime/blob/master/src/object.di#L519
It has been marked for deprecation in the upcoming 2.066 release.
Mike