std.xml should just go

spir denis.spir at gmail.com
Fri Feb 4 12:12:57 PST 2011


On 02/04/2011 07:49 PM, so wrote:
> 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;

Runs with opEquals signature expected by the compiler:

struct A {
     int whatever;
     const bool opEquals(ref const(A) a) {
         return whatever == a.whatever;
     }
}
unittest {
     const(A) a;
     A b;
     assert(a == b);
}

But what do you actually /mean/?

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list