Questions tagged [cyclic-reference]

A cyclic reference is established if object A holds a reference to B while B holds a reference to A.

A cyclic reference is established if object A holds a reference to B while B holds a reference to A. This exposes a dynamic problem ("hen-vs-egg"), for instance in a programming language, to create a cyclic reference, A and B must be known prior to establishing their inter-relationship. Thus a form of temporal sequence (delay) is needed if data structures are purely functional, for example by declaring the initialization of the references lazy. Cyclic references can also pose problems to garbage collection which needs to detect that none of two objects involved in a cyclic reference are reachable any more by the rest of the code.

143 questions
2
votes
2 answers

Cyclic dependencies- always wrong?

1.I would like to know if the following structure is incorrect, what is the reason, and what is the solution for that: Assume I have implemented a client for net game The client has 2 main packages: A.GUI - hold all the swing Jpanels…
JavaSa
  • 5,813
  • 16
  • 71
  • 121
2
votes
1 answer

Get around 3rd party cyclic dll dependencies?

I am attempting to access text in a TE Edit (from ter32.dll) in a 3rd party application. (first post on this here) I looked through the API and tried to dynamically load the dll in order to access a function. Unfortunately, this (aftermarket…
b-p
  • 307
  • 3
  • 10
2
votes
3 answers

How to compile and run inter-dependent plugin jars

I have to build two eclipse-plugin projects into two separate jars with each one dependent on the other for compiling. Eclipse IDE complains about "cyclical dependency...". How do I build these plugin jars? I guess running these plugins by just…
2
votes
1 answer

Spring beans dependencies cycle - conversionService to DAO to PropertiesFile to conversionService

My Spring Boot application has a converter registered to ConversionService which is dependent on a service, which in turn depends on a Dao. The Dao depends on @ConfigurationProperties annotated object injected as a constructor parameter named…
2
votes
1 answer

Cyclic references in PHP 7.4

In PHP 7.4 I noticed the number of collected cycles returned by gc_collect_cycles is always zero when there is a destructor method in a cyclic referenced object. class A { public function __destruct() { } } gc_disable(); $a1 = new A; $a2 =…
Rain
  • 3,416
  • 3
  • 24
  • 40
2
votes
0 answers

Circular reference between two structs with high performance

I have two structs Node and Communicator. Node contains "business-logic" while Communicator contains methods for sending and receiving UDP messages. Node needs to call methods on Communicator when it wants to send messages and Communicator needs to…
2
votes
2 answers

Cyclic function/type dependency in F#

I have a question about the best way to go about the following I Have a class B, I have a combinator on B, let foo : B -> int. I want the class B to have the combinator encapsulated as a method, so I add it with a type extension. I then later on…
Snark
  • 1,664
  • 14
  • 27
2
votes
3 answers

Why do we need to detect a loop in a linked list

I see many Q/A on how to detect a loop in linked list, but I want to understand is why we want to do that, in other words what are the practical use cases of detecting a loop in a linked list
2
votes
1 answer

Does `gc` treat Cython's `__dealloc__` similarly to `__del__`?

Python's optional garbage collector gc ignores cycles that contain any object with a __del__ method: Changed in version 3.4: Following PEP 442, objects with a __del__() method don’t end up in gc.garbage anymore. Cython extension types can have a…
0 _
  • 10,524
  • 11
  • 77
  • 109
2
votes
1 answer

Cyclical constexpr

I'd like to construct some state machines using constexpr in C++, which requires the states and their transitions to be constexpr as well. If the state machine has a cyclical portion (eg. state 1 has a transition to state 2, and state 2 has a…
Brent
  • 4,153
  • 4
  • 30
  • 63
2
votes
3 answers

forward declaration in two headers and two cpp files

I have four C++ files, two headers and two cpp. The headers are properly guarded and in the first I use a forward declaration like this: //A.h class B; class A { public: A(); void doSomething(B* b); }; and some implementation: void…
w.izzy
  • 21
  • 4
2
votes
0 answers

Difference between [weak self] and weak var weakSelf = self?

I was going through closure in swift3. I read that in closure to avoid cyclic reference we declare list of captures, like [weak self]. In objective-C we used to declare weak reference to self and use that weak reference in blocks as below: weak…
Nuzhat Zari
  • 3,398
  • 2
  • 24
  • 36
2
votes
2 answers

Code that makes cyclic reference for x spaces in list

I have a tasko to make a program in which i get m, n and k. I should create a list a with n*m element. List b is supposed to have n*m element. It is created from list a with cyclic shift k to the right for m elements of lists. I know it is poorly…
Srcheko
  • 21
  • 1
2
votes
3 answers

Can a JavaScript object's child reference itself?

I have a JavaScript object Team and a Score which represent points and some other functions. I want to know if it's safe to store the team in the score at the same time as storing the score in the team. var Score = function(team){ this.team =…
Djave
  • 8,595
  • 8
  • 70
  • 124
2
votes
1 answer

Workaround for Jackson infinite recursion in third party classes

Is there any way of programatically telling jackson to ignore a property? For instance, by name. My problem is that I'm serializing third party objects, some of which have parent/child cyclic dependencies that…
user3748908
  • 885
  • 2
  • 9
  • 26