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
0
votes
1 answer

Python problem with imports from file in the same folder

i'm having a problem with imports: i have this folder structure: Q2AInterface __init__.py Q2A.py Question.py Like.py main.py And to make it short the content are something like this: Q2A.py: from . import Question from . import…
0
votes
1 answer

How to build query where 2 fields are inter dependent in MSSQL

I am new to the world of SQL queries, I am comfortable writing basic sql queries limited to to CRUD operations. I am now working on a project where I have to write complex queries and I am seeking help on how to do it. Scenario I have a table x The…
0
votes
1 answer

Cyclic reference when a java util library is tested with external mock util library also using the java util lib

Problem In java, I have a a "Util project" using another "Mock project" when doing unit test. My problem is that the "Mock Project" is as well using the "Util project" to build some of the Mock object. When i use maven to build my projects, i can't…
fra
  • 83
  • 1
  • 11
0
votes
0 answers

Cyclic dependency is forcing me to split service and factory depending on state. Is it ok?

I am creating a JavaFX desktop application using the MVVM pattern. Each View requires a ViewModel. Instead of using ViewA viewA = new ViewA(new ViewModelA());, I decided to abstract it using the factory pattern. The ViewFactory constructor has…
0
votes
1 answer

Eclipse PHP projects give error: "A cycle was detected in the build path of project"

I have 3 php projects that depend on each other. They can't be grouped in one project because each of them has a different environment they execute in. When I build it, I have no errors except this: Now I can find for Java how to disable errors on…
Tschallacka
  • 27,901
  • 14
  • 88
  • 133
0
votes
3 answers

Avoid circular reference on many-to-many object relations

I'm facing some object relationship problems in an application that, among other things, handles multiple choices exercises. Thinking of those exercises, I can that: 1- I have several exercises, that have several questions that have several…
0
votes
1 answer

Python cyclic import unexpected behavior

I have discovered something unexpected when playing with cyclic imports. I have two files in the same directory: a.py import b print("hello from a") b.py import a print("hello from b") Running either python3 a.py and python3 b.py does not result…
0
votes
1 answer

Understanding Shared_ptr with cyclic references?

I want to understand the way shared_ptr increments or decrements the reference counts? #include #include class B; class A { public: std::shared_ptr b_ptr_; }; class B { public: std::shared_ptr a_ptr_; }; void…
red_dragon
  • 13
  • 2
0
votes
3 answers

Mutual recursion between objects in Python

I'm currently working on a module that allows users to build an arbitrary task network model (for use in a discrete event simulation) by creating instances of task objects (my module provides a task class). Among other things, a task contains logic…
0
votes
1 answer

How to resolve cyclical links in typedefs?

I need to resolve this thing somehow: class MyType; // this thing doesn't help here typedef std::stack()>>> MyType; I get an error like this one error C2371: 'MyType': redefinition;…
Hakuhonoo
  • 33
  • 1
  • 7
0
votes
1 answer

Higher kinded type chained, possible?

I have something like: trait Node[P <: Node[_]] class RootNode extends Node[Null] { val refB : NodeB[RootNode] = .... } class NodeB[P <: Node[_]] extends Node[P] { val refC : NodeC[NodeB[P]] = .... } class NodeC[P <: Node[_]] extends…
lqbweb
  • 1,684
  • 3
  • 19
  • 33
0
votes
0 answers

strange issue with serialisation after upgrading to PHP 5.5, max cyclic reference depth?

I have a rather large graph full with cyclic references in PHP memory. I was serialising the whole graph to store it in between requests. It worked well on PHP5.3, but now I upgraded to PHP5.5 and something strange is happening: PHP / Apache…
Flion
  • 10,468
  • 13
  • 48
  • 68
0
votes
1 answer

Model-Controller cyclic reference/design problem

I have a CoreData entity X, and controllers for this entity, XController. Now there's another entity, XGroup, containing a collection of X entities, and a XGroupController. Now the problem is that XGroupController needs to interact with…
jasamer
  • 23
  • 3
0
votes
1 answer

circular reference class loading in php/codeigniter

In CodeIgniter I have a model named User_Model and another one named Product_Model Now in the User_Model constructor I am loading couple of models that I use in the class. class User_Model extends CI_Model { public function __construct() { …
Undefined Variable
  • 4,196
  • 10
  • 40
  • 69
0
votes
1 answer

Entity Framework Code First: One-to-many cyclic reference

I'm using EF 6.1 with code-first and auto migrations enabled. So far my model (relevant properties only) looks like this: public class Inventory : IEntity { public virtual ICollection Rooms { get; set; } public virtual…