Questions tagged [self-reference]

Self-reference is the ability of a program (or logical sentence) to refer to itself, either directly or indirectly.

Self-reference is the ability of a program (or logical sentence) to refer to itself, either directly or indirectly.

Useful Links:

Stanford Encyclopedia 'Self Reference' Entry

Related Tags:

596 questions
6
votes
2 answers

Self-referencing class: concrete python class from C interface

I am trying to design a C interface which could easily be extended in Python (using ctypes). I've used the natural idiom in C: struct format { int (*can_open)(const char *filename); struct format * (*open)(const char *filename); void…
malat
  • 12,152
  • 13
  • 89
  • 158
6
votes
4 answers

PHP: if ($Name=='ProxiedIP') leads to 500 (Internal Server Error)

This may be too obscure of an question, but I've been troubleshooting a baffling server error for hours and have pinned it down to the most bizarre issue; at this point I just want to know if anyone has ever had something similar occur, or might…
jtrick
  • 1,329
  • 18
  • 23
6
votes
2 answers

Self reference in interfaces

Okay, here is what i would like to do. Class Container { T contained; public void ContainObject(T obj) { contained = obj; if(/*Magical Code That Detects If T Implemtns IContainableObject*/) { …
Georges Oates Larsen
  • 6,812
  • 12
  • 51
  • 67
5
votes
1 answer

Rails self-referential has_many through with custom naming of join table

I have some troubles wrapping my head around the following situation.. I am trying to create a tree structure, where I will be able to give custom names to connections between nodes.. So I want to have Node and Relation models. Each Node …
Stpn
  • 6,202
  • 7
  • 47
  • 94
5
votes
2 answers

C++ map -- Self referencing iterator

Is there a way to declare a std::map whose value type is an iterator to itself? map::iterator> myMap; The above code snippet wouldn't work because the iterator type needs to know the second template argument, marked as (#).…
Anakhand
  • 2,838
  • 1
  • 22
  • 50
5
votes
1 answer

Many-To-One, Self-referencing with Inheritance Mapping

I have some entites with common relations and attributes. So, I want to simplify my schema using inheritance mapping. I created a BaseData mappedsuperclass, and make my other entities expand it. This BaseData class has the common relations I need in…
TiPi
  • 330
  • 4
  • 19
5
votes
1 answer

Entity Framework Code First Self Referencing Parent Child with Payload

I'm attempting to set this up using code first in entity framework and am running into difficulty. To describe what i'm trying to accomplish: Have an entity of Product. This product optionally may have one or more related "child" products. A product…
Bumble
  • 97
  • 1
  • 7
5
votes
1 answer

Symfony2 Doctrine, setup a page with many to many self referencing relationship

I have tried following the instructions on Doctrines manuals: http://docs.doctrine-project.org/en/latest/reference/association-mapping.html#many-to-many-self-referencing I'm trying to setup a pages entity, which has many subPages and I would also…
jaget
  • 2,149
  • 6
  • 21
  • 29
5
votes
2 answers

Array Self-Referencing Map - Very Bizarre Result

While experimenting with some different methods for generating JavaScript arrays, I stumbled on a weird result. Using map to push an array of self-references (DEMO): a=[1,1,1,1,1,1,1,1,1,1]; a=a.map(a.push,a); I get the following result (in…
mellamokb
  • 56,094
  • 12
  • 110
  • 136
5
votes
3 answers

Interpretation as a local variable overrides method name?

As in this question, when a local variable not defined is used within its own assignment, it is evaluated to nil. x = x # => nil But when the name of a local variable conflicts with an existing method name, it is more tricky. Why does the last…
sawa
  • 165,429
  • 45
  • 277
  • 381
5
votes
1 answer

Doctrine2 One-To-Many, Self-referencing relationship

In my 'Topic' entity, I have a One-To-Many, Self-referencing relationship $parent:$children. class Topic { /** @ORM\Id * @Column(type="integer") * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /**…
qais
  • 1,808
  • 3
  • 20
  • 31
4
votes
2 answers

Does Python have NO need for the Y-Combinator?

After an hour of trying to understand the Y-Combinator... i finally got it, mostly but then i realized that the same thing can be achieved without it... although I'm not sure if i fully understand it's purpose. eg. Factorials with Y-Combinator print…
user1218995
4
votes
1 answer

Lifetime issues with FuturesUnordered

I'm trying to store these Readable instances on the Coordinator struct and have a schedule method that picks one of the readables and pushes it into a FuturesUnordered instance (also inside Coordinator) to be pulled later. Problem is: This doesn't…
rcmgleite
  • 1,303
  • 1
  • 18
  • 22
4
votes
3 answers

Self-referential data type with single constructor cannot be `Show`n

This is from The Little MLer. I have this data Chain = Link Int (Int -> Chain) and this ints :: Int -> Chain ints n = Link (n+1) ints I'm rather confused as to what exactly is happening here. It seems like an endless recursion of itself where…
147pm
  • 2,137
  • 18
  • 28
4
votes
1 answer

How to build self referencing tables in Symfony using Propel ORM

I have an error trying to build a model from an existing database in a symfony project using the Propel ORM. The error is this: build-propel.xml:474:20: The 1:1 relationship expressed by foreign key a_table_on_my_schema_FK_1 is defined in both…
Andreu Ramos
  • 2,858
  • 2
  • 25
  • 36