cyclic-reference

Circular dependency with constructor injection

十年热恋 提交于 2019-12-23 12:51:23
问题 Say I have the following components: Producer produces numbers and sends messages to Consumer Both Producer and Consumer send messages to Monitor Monitor, say randomly, decides when the produce / consume process should stop and sends a message to Stopper Stopper then stops both Producer and Consumer cleanly I know this is easy to accomplish in a mutable language such as Java. I know also this can be resolved by allowing partial mutability with interfaces, such as described here. However, it's

C++ cyclic inclusion issue [duplicate]

走远了吗. 提交于 2019-12-19 09:52:48
问题 This question already has answers here : Resolve build errors due to circular dependency amongst classes (11 answers) Closed 2 years ago . I have this file logger.hpp: #ifndef _LOGGER_HPP_ #define _LOGGER_HPP_ #include "event.hpp" // Class definitions class Logger { public: /*! * Constructor */ Logger(); /*! * Destructor */ ~Logger(); /*! * My operator */ Logger& operator<<(const Event& e); private: ... }; #endif And this file event.hpp #ifndef _EVENT_HPP_ #define _EVENT_HPP_ #include <string

How to initialize and “modify” a cyclic persistent data structure in Scala?

会有一股神秘感。 提交于 2019-12-17 23:46:35
问题 I have searched and found some info on this topic but the answers are either confusing or not applicable. I have something like this: class Thing (val name:String, val refs:IndexedSeq[Ref]) class Ref (val name:String, val thing:Thing) Now, I want to say, load in a file, parse it and populate this data structure from it. It being immutable and cyclic, how might one do so? Also, let's say I do get this data structure populated, now I want to modify it, like change rootThing.refs(3).name, how

SQL SELECT to find cyclic references in father-ID-organized tree?

丶灬走出姿态 提交于 2019-12-13 13:05:29
问题 "Fun" with cyclic references: Suppose I have a table ELEMENTS which contain a hierarchy of elements, modeled by a father ID. The father ID field is null for the root. All other records have a non-null father id with the (autosequenced) primary key ( ID ) of the father element. For example, using SELECT * FROM Elements WHERE FATHER_ID not in (SELECT ID FROM Elements) I can find all elements that have invalid father references ( FATHER_ID is not a foreign key, let's assume that in this example)

Get around 3rd party cyclic dll dependencies?

断了今生、忘了曾经 提交于 2019-12-12 18:02:22
问题 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 rework) of ter32.dll has a load of dependencies. I tried dynamically loading each required dll as needed but ran into a cyclic dependency. ter32.dll requires x. x requires y. y won't load because it requires x. Would I have to statically load these with a

Initialization order of values in objects: How to setup cyclic/recursive objects properly?

我们两清 提交于 2019-12-11 02:22:51
问题 The following code abstract class Table(val name: String) { val columns: List[Column] def getAliasColumns: String = { val reallyThere = columns.forall(c => c != null) println("Columns really there: " + reallyThere) if (reallyThere == false) { println(" columns " + columns) } columns.map(c => s"${c.table.name}.${c.name} as ${c.table.name}_${c.name}") .mkString(", ") } } class Column(val table: Table, val name: String, val foreignKey: Option[Column]) object Column { def apply(table: Table, name

Cyclic function/type dependency in F#

倾然丶 夕夏残阳落幕 提交于 2019-12-10 23:04:44
问题 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 realize that foo is quite expensive and want to cache it's result with lazy evaluation So I add a huge clutch to the system by passing the combinator as a function to the constructor and then initializing a field with foo = lazy(foo self) in the

Can using Scalar::Util's weaken cause invalid reference problems?

烂漫一生 提交于 2019-12-10 18:26:01
问题 Please see this related question for some background information. Note: When I say "invalid reference" I mean a reference that points to no data. Assume we have the following data structure containing cyclic references: +-----------------------------------------------------+ | | +-->+============+ +==========+ | [ Reference ----->[ Blessed ] | $parent -->+============+ [ Hash ] | [ ] +==========+ | [ children --->[ Array ] | [ ] [ ] | +==========+ [ 0: ---------+ | [ ] | | +==========+ | | |

Why is there no cyclic layout issue for classes in C#?

有些话、适合烂在心里 提交于 2019-12-09 16:29:13
问题 public struct Unit { Unit u; } Causes: Struct member 'Unit.u' of type 'Unit' causes a cycle in the struct layout. But public class Unit { Unit u; } compiles. I understand the problem I suppose. An endless cycle will be formed when referencing a Unit object since it will have to initialize another member Unit and so on. But why does the compiler restrict the problem just for structs ? Doesn't the issue persist for class too? Am I missing something? 回答1: The problem is in terms of layout . When

Maven says I have a cyclic reference in multi-module project but can't figure out why

[亡魂溺海] 提交于 2019-12-06 22:36:56
问题 I have a multi-module project that looks like this: module1 pom.xml module2 pom.xml pom.xml The pom.xml in module2 has a dependency on module1. When I run mvn clean compile I get the following error: The projects in the reactor contain a cyclic reference. Here are my dependencies in module1: <dependencies> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId>