From 6f25642601272bc4f10c56b15f3ad30299afbdac Mon Sep 17 00:00:00 2001 From: dcode Date: Mon, 8 Apr 2019 04:18:13 +0200 Subject: [PATCH] add a note on acyclic detection --- src/program.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/program.ts b/src/program.ts index 2d33919d..a8d3f79d 100644 --- a/src/program.ts +++ b/src/program.ts @@ -3259,6 +3259,16 @@ export class Class extends TypedElement { /** Tests if this class potentially forms a reference cycle to another one. */ private cyclesTo(other: Class, except: Set = new Set()): bool { + // TODO: The pure RC paper describes acyclic data structures as classes that may contain + // + // - scalars + // - references to classes that are both acyclic and final (here: Java); and + // - arrays (in our case: also sets, maps) of either of the above + // + // Our implementation, however, treats all objects that do not reference themselves directly + // or indirectly as acylic, allowing them to contain inner cycles of other non-acyclic objects. + // This contradicts the second assumption and must be revisited when actually implementing RC. + if (except.has(this)) return false; except.add(this); // don't recurse indefinitely