Phobos2: sorting and std.typecons.Tuple
Christopher Wright
dhasenan at gmail.com
Mon Apr 27 14:46:27 PDT 2009
Andrei Alexandrescu wrote:
> bearophile wrote:
>> Andrei Alexandrescu:
>>> s/recursive/transitive/
>>> Litmus test: recursive could recurse forever. Transitive never does.
>>
>> I have used the word recursive because the functions I have designed
>> (and I think they are designed correctly) call themselves until they
>> stop calling themselves because a stopping criterion is met. That's
>> recursivity, I think.
>
> But then what if you have a web of class objects that ultimately will
> close a cycle?
>
> Transitive: you'd use a worklist. Recursive: you'd recurse forever.
>
>
> Andrei
bearophile explicitly said "structs". I assume it would extend to
primitives, treating pointers as integer types. I also assume it would
call .toHash on any object.
This would still allow you to recurse infinitely, but it would require
added effort:
struct S
{
C c;
}
class C
{
S s;
this () { s.c = this; }
auto toHash () { return s.toHash; }
}
More information about the Digitalmars-d
mailing list