Wednesday, May 02, 2012

Quick post - a question about Tribal Ownership

Tribal Ownership is probably the work I am most proud of. The idea is that syntactic nesting of classes gives semantic nesting of objects, with very little extra syntax. (Note, the original idea is not mine, it was proposed in the original Tribe paper, and may have been known before).

A challenge for this kind of approach has occurred to me: a common case is that we want a tree where the children are owned by their parents, and each node has the same class. It is easy to have a tree where all nodes are owned by a single object, but I think the common situation where a parent owns its children is not possible. It would be good to have a solution to this, without changing the language too much. Or prove that we never really need this, and a tree where all nodes are owned by the root or a manager is OK in some situations (perhaps only some very limited applications of ownership). No ideas right now though, if you have an idea, leave a comment, or write it up and publish it!

4 comments:

James said...

Hi Nick

I haven't gone back to the paper, but can't a class just "import" itself?

If there's a library class List somewhere, and I want to own an instance of List, I import it to this.List and then I own those instances.

So if this works in any other class, I don't see why this won't work inside the definition of class List? Isn't out.List is the class I'm defining, so this.List is a class I own?

James said...

As for the Tribal Ownership nesting, yes it's been around for a long time - indeed Object Teams/Java implements something along these lines and that's been around for quite a while...

Nick Cameron. said...

But importing is a static device, if you want a tree of arbitrary height, I don't think you can import as many times as you need to. Although maybe we could make import dynamic and allow this as a way to implement a solution - that would be cool!

Nick Cameron. said...

I thought Dave's thesis was the first to mention using class nesting for ownership? But I don't properly recall. I may just have mistaken it for every other idea in ownership, most of which were in Dave's thesis.