Comment on this RCR (edit wiki page) | RCRchive home

RCR 177: linking object : mapping on object from an other

submitted by bille2 on Sun Dec 21 2003 06:53:12 AM -0800

Status: pending


Abstract

In C language, you can >>link<< 1 variable with another. Indeed something like *c = *p, so change p to p = 2, and c would also take 2 as value.

Problem

I want some part of my ruby's object to be linked to existing ones from an other object

Proposal

So it would be nice if, for example : &c = &p and p = 2 produce c = 2

Analysis

I think it would be simple ...

Implementation

An simple memory link, as in C, where *c and *p involve that c and p share the same memory portion ! Many thanks for listening users !


Vote for this RCR

Strongly opposed [14]
Opposed [1]
Neutral [1]
In favor [0]
Strongly advocate [1]

Change the status of this RCR to:

accepted

rejected

withdrawn


Add comments here


Can I just say "no" to this proposal?

Because:

So I demand you to come back with why you really need this.

matz.


This is a cross-cutting concern, so it is an AOP-type feature. You may consider a more robust solution. A thread on suby-muse recently introduced the idea of sharable namespaces. For example:


  
  namespace N
    attr_accessor :x
  end
class A share N end
class B share N end
a = A.new b = B.new
a.x = 5 b.x # => 5

If you would be interested in flushing this out more, and help in improving your RCR, please join at:

  http://lists.berlios.de/mailman/listinfo/suby-muse

The folks there are more than happy to discuss. ---

Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog