Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement circular reference support as a msgpack D language extension #7

Open
ghost opened this issue Feb 27, 2013 · 7 comments
Open
Assignees

Comments

@ghost
Copy link

ghost commented Feb 27, 2013

Originally filed here: Msgpack-81

A first implementation is provided in this tree: ClassRefs (not tested with latest compiler yet).

I think we should consider implementing the feature as some sort of msgpack extension. Since msgpack-d is very fast, supports binary serialization (Orange doesn't), and is a small codebase with no dependencies it would be a net-win if we supported this even if it's only an extension.

@ghost ghost assigned repeatedly Feb 27, 2013
@repeatedly
Copy link
Member

It's a interesting thing.

But currently MessagePack itself is now discussing the format specification.
(This discussion started with adding string type proposal)

msgpack/msgpack#128

Please wait until this discussion is finished.

@ghost
Copy link
Author

ghost commented Feb 27, 2013

Sure thing, I actually saw that discussion before (it's huge) and thought it might be relevant to this. I guess you could bring this topic up with the msgpack team if it's relevant to them.

@repeatedly
Copy link
Member

https://github.com/msgpack/msgpack/blob/master/spec.md

New MessagePack format supports ext type with serveral sizes.
After msgpack-d followed new format, we may use ext type for circular reference support.

@ghost
Copy link
Author

ghost commented Feb 17, 2014

That's awesome to hear. I really think msgpack-d could become a de-facto library to use for serialization in D. There are other efforts of course, but they all seem to be very complicated and slow.

@timotheecour
Copy link

Is there any update on that? Dealing with circular references would make serialization a whole lot easier for client code

@timotheecour
Copy link

Here's a minimal test case:

class A{B b;}
class B{A a;}
void main(){
  auto a=new A;
  auto b=new B;
  a.b=b;
  b.a=a;
  auto data = pack(a);//CRASHES
  auto a2 = unpack!A(data);
  assert(a2.b.a==a2);
}

@timotheecour
Copy link

hacked the code to make it work; i can try to make a pull request if anyone is still interested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants