Re: JS log-dumping an object and circular references problem
"R.Wieser" <[email protected]> Mon, 8 Feb 2021 14:07:10 +0100
| Newsgroups | gmane.comp.mozilla.general |
|---|---|
| Message-ID | <[email protected]> |
Dave, > Seen this? > <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value> Yep. Its the example filtering code at the bottom using a WeakList that I tried - and which did not work due to to the "seen.add(value)" throwing an error. > It can't be infinitely recursive, surely? Yes it can ! :-) Just imagine an array which, as one of its values, contains (a reference to) itself. Or a fork-bomb if that means more to you. Or even a circular list (where does it end ?). By the way, although I really would like to know why that WeakList doesn't work, I replaced it with a simple array to see if it would work. And even that has its own problems (keeping stored objects alive until I (correctly!) release the array) it seems to work allright. Also, I've stil got the first problem (a simple assignment failing). Regards, Rudy Wieser