std.xml should just go

Walter Bright newshound2 at digitalmars.com
Fri Feb 4 12:44:51 PST 2011


so wrote:
>> Examine the API of a function in a library. It says it doesn't modify 
>> anything reachable through its arguments, but is that true? How would 
>> you know? And how would you know if the API doc doesn't say?
> 
> You are right, but try to look at this from another angle (probably i am 
> not making any sense here). Should "D const" be perceived this way?
> When i say "const A", it broadly means don't assign to this.

That's "head const", which is what C++ has. The const system in C++ does not 
work. If you view const strictly as a storage class, that fails as soon as you 
introduce pointers.


>> You'd fall back to const by convention, and that is not reliable and 
>> does not scale. You have to manually go through an entire hierarchy of 
>> function calls to figure out if one might change a member of the data 
>> structure, and then after a few maintenance cycles, you have to do 
>> that all over again.
> 
> I have no idea how to solve this for documentation and such but the 
> second you compile the source, everything will be clear as day.

As I wrote in another reply to you, there are many cases where the compiler 
cannot determine this.


More information about the Digitalmars-d mailing list