std.xml should just go

so so at so.do
Fri Feb 4 10:49:42 PST 2011


On Fri, 04 Feb 2011 19:33:09 +0200, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> spir wrote:
>> On 02/04/2011 08:34 AM, Jonathan M Davis wrote:
>>> Slices: just one more reason why D's arrays kick the pants of other  
>>> languages'
>>> arrays...
>>  What are the other ones?
>
> Scope guard is another.
>
> I would argue that transitive const is, too, but the benefits of that  
> are harder to see.

There are many features small in detail but superb in practice.
But still, i keep saying D has design errors as well, to me the biggest  
one and maybe the main reason why D1 crowd is hostile to D2.

Const system (CS):

CS in theory a great thing, in practice it has many corner cases, simply  
it doesn't worth having.
D had(still has) a chance to fix this issue in two different ways, either  
avoid it or don't leave holes. This hole is not that explicit in C++  
because it is not transitive.
Transitive const brings something with it... transitivity!

Now, what i mean with this:

---
struct A {
	B whatever;
	bool opEquals(A a) {
		return whatever == a.whatever;  // just comparision, this function is  
const
	}
	bool anything(A a) {
		whatever = 2; // here i have an assignment, this function is not const
		return whatever;
	}
}
---

It doesn't matter what signature you use for the function, compiler is  
aware and will output an error when you do the opposite of the signature.  
If this is the case, why do we need that signature?
Its presence just makes things complicated and with actually no reason.

---
struct A {
	B whatever;
	bool opEquals(A a) {
		return whatever == a.whatever;
	}
}

const(A) a;
A b;
bool e = a == b;
----

Thanks;


More information about the Digitalmars-d mailing list