Isn't "transitive" the wrong word?
Steven Schveighoffer
schveiguy at yahoo.com
Sat Apr 5 05:40:22 PDT 2008
"Janice Caron" wrote
> On 04/04/2008, Manfred Nowak wrote:
>> Janice Caron wrote:
>>
>> > So the relation is
>> [...]
>>
>> y is reachable from x (through a series of pointers for example)
>>
>>
>> Reachable is transitive:
>>
>> if z is reachable from y
>> and y is reachable from x
>>
>> then
>>
>> z is reachable from x
>>
>>
>> In D the transitivity of reachability carries over to const:
>>
>> if x is const
>> and z is reachable from x
>>
>> then
>>
>> z is const
>
> My apologies for being thick, but I still don't get it. What /exactly/
> is the binary relation R, such that:
>
> (1) (a R b) and (b R c) implies (a R c), is true in D
> (2) (a R b) and (b R c) implies (a R c), is false in C++
>
> I still can't figure that out. Am I just missing something obvious?
>
> And even assuming there is such an R, wouldn't it make more sense to
> say "R is transitive", rather than "const is transtive"?
>
> Help me - I'm confused.
If c contains b, and b contains a, then the R becomes "is made const by" So
you have:
if(a is made const by b) and (b is made const by c) then (a is made const by
c)
True in D, false in C++.
-Steve
More information about the Digitalmars-d
mailing list