April 04, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to BCS | BCS <BCS@pathlink.com> wrote in news:ft5pqk$eam$5@digitalmars.com: > Walter Bright wrote: >> Janice Caron wrote: >> >>> Sorry to go all grammar/mathematics nit-picky, but isn't "transitive" completely the wrong word? >> >> >> No, it is used in this sense in academic papers on the subject. > > That might not answer the question. To a perhaps surprising degree, that actually does answer the question. The Holy Roman Empire was neither holy nor Roman nor an empire--but was, for all of that, the Holy Roman Empire. If Twinkies can count as food, then a recursive const can surely count as transitive if enough people call it transitive. :-) -- JMNorris | |||
April 04, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | On 04/04/2008, Manfred Nowak <svv1999@hotmail.com> wrote:
> Janice Caron wrote:
>
> > The word "transitive" applies to binary relations
>
>
> From the article on const:
> "Const being transitive in D means that every reference reachable
> through the const is also const."
>
> This is clearly expressing a binary relation.
So the relation is (a is const and b is const and a is reachable from b)?
Correct me if I'm wrong, but isn't it also true that in C++,
(a is const and b is const and b is reachable from a) and
(b is const and c is const and c is reachable from b) implies
(a is const and c is const and c is reachable from a) ?
That would be a transitive binary relation, no?
What am I missing?
| |||
April 04, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Janice Caron | On Fri, 04 Apr 2008 16:57:43 +0100, Janice Caron wrote:
> On 04/04/2008, Jesse Phillips <jessekphillips@gmail.com> wrote:
>> Except when you look at the definition of transitive in the dictionary,
>> "having or containing an object required to complete the meaning."
>> Thus if we have a transitive const then all things inside it must also
>> be const.
>
> What dictionary are you reading? It doesn't say that in Chambers or Merriam-Websters.
>
> M-W says
> 1 : characterized by having or containing a direct object <a
> transitive verb> <a transitive construction>
> 2 : being or relating to a relation with the property that if the
> relation holds between a first element and a second and between the
> second element and a third, it holds between the first and third
> elements <equality is a transitive relation>
> 3 : of, relating to, or characterized by transition
>
>
>> I see no reason to make changes.
>
> Given that transitive isn't a keyword, there are no changes to make. (I
> was just being nitpicky.)
>
> That said, I do suspect that using odd words in discussion or articles or whatever doesn't help lessen confusion.
Well, I got it out of my Merriam-Websters and I don't think anyone is really mixing up the meaning of transitive with respect to D. But anyway it seams to have brought out a good idea, and I'm interested to see Walters input on it.
| |||
April 04, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Janice Caron | 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
-manfred
| |||
April 05, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | On 04/04/2008, Manfred Nowak <svv1999@hotmail.com> 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.
| |||
April 05, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Janice Caron | "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
| |||
April 05, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Janice Caron | Janice Caron wrote: >> 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? a R b =(def) if a is const and b is reachable from a then b is const Counter example in C++: int* const pY; // constant pointer to changeable int *pY = 4; // legal - can use pY to modify an int pY = &someOtherIntVar; // illegal - can't make pY point anywhere else [cited from: http://www.possibility.com/Cpp/const.html] -manfred | |||
April 05, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | On 05/04/2008, Manfred Nowak <svv1999@hotmail.com> wrote:
> a R b
> =(def)
> if a is const and b is reachable from a
> then b is const
Got it. It took me a while to prove it, but the relation you cite is indeed transitive in D, but not in C++. So, it is correct to say:
STATEMENT 1:
The relation "(a is const) and (b is reachable from a) => (b is
const)" is transitive in D, but not in C++.
However, I still dispute that it is correct to say:
STATEMENT 2:
const is transitive in D, but not in C++.
In what sense is statement 2 equivalent to statement 1?
The way I see it, statement 2 cannot be true, since "const" is not a relation.
| |||
April 05, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Janice Caron | Janice Caron wrote:
> STATEMENT 2:
> const is transitive in D, but not in C++.
> In what sense is statement 2 equivalent to statement 1?
The clause "with respect to reachability" is conviniently omitted, because it should be clear from the context.
-manfred
| |||
April 05, 2008 Re: Isn't "transitive" the wrong word? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | On 05/04/2008, Manfred Nowak <svv1999@hotmail.com> wrote:
> Janice Caron wrote:
>
> > STATEMENT 2:
> > const is transitive in D, but not in C++.
> > In what sense is statement 2 equivalent to statement 1?
>
> The clause "with respect to reachability" is conviniently omitted,
> because it should be clear from the context.
Aha - so
(1) "const" is short for "const with respect to reachability", and
(2) "const with respect to reachability" actually means "(a is const)
and (b is reachable from a) implies (b is const)".
So, when we say "const is transitive", what we /in fact/ mean is:
((a is const) and (b is reachable from a) implies (b is const)) and
((b is const) and (c is reachable from b) implies (c is const))
implies ((a is const) and (c is reachable from a) implies (c is
const))
Now why didn't I see that before? It's just so blindingly obvious! (The sarcasm wasn't aimed at you, by the way. Thanks for explaining).
So, we're all clear, right? Everyone understands why we say "const is transitive", not "const is recursive"?
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply