www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Help test Google flatbuffers

reply Brian <zoujiaqing gmail.com> writes:
Project:
https://github.com/putao-dev/google-flatbuffers

Pull address:
https://github.com/google/flatbuffers/pull/3856

dub project:
http://code.dlang.org/packages/flatbuffers
May 14 2016
next sibling parent Dsby <dushibaiyu yahoo.com> writes:
On Saturday, 14 May 2016 at 15:25:58 UTC, Brian wrote:
 Project:
 https://github.com/putao-dev/google-flatbuffers

 Pull address:
 https://github.com/google/flatbuffers/pull/3856

 dub project:
 http://code.dlang.org/packages/flatbuffers
Great!
May 15 2016
prev sibling parent reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On Saturday, 14 May 2016 at 15:25:58 UTC, Brian wrote:
 Project:
 https://github.com/putao-dev/google-flatbuffers

 Pull address:
 https://github.com/google/flatbuffers/pull/3856

 dub project:
 http://code.dlang.org/packages/flatbuffers
Nice to see someone working on this! A few general bits of feedback: (1) I am not sure I see the rationale for using classes for the data structures -- is there anything that actually requires it? It would probably be better to use structs, possibly using ` disable this();` if it's required that the buffers never be created without being initialized. (2) It's probably more idiomatic to use `void[]` for buffers of binary data, although I imagine you may have some reasons for using `ubyte[]` ... ? (3) Style point: variable/function names beginning with an underscore `_` are I believe reserved for the runtime (lots of people don't obey this convention, but it's a good idea to do so). (4) I'm not sure I see the point of connection between flatbuffer schemas and what is implemented here -- it looks like the underpinnings of how flatbuffer data would be stored and manipulated ... ? It would be very good if things could be worked out so that one could define at compile time a D data structure based on a flatbuffer schema, such that one can interact with it "as if" it were a collection of idiomatic D data structures; see e.g. how it works with dproto and protobuf schemas: https://github.com/msoucy/dproto/#simple-example (5) To my eyes the modules and functionality are rather sparsely documented; it would be good if documentation could be extended (particularly with usage examples).
May 15 2016
parent timotheecour <timothee.cour2 gmail.com> writes:
On Sunday, 15 May 2016 at 14:08:57 UTC, Joseph Rushton Wakeling 
wrote:
 (2) It's probably more idiomatic to use `void[]` for buffers of 
 binary data, although I imagine you may have some reasons for 
 using `ubyte[]` ... ?
curious about this. https://dlang.org/phobos/std_outbuffer.html defines: ``` pure nothrow safe ubyte[] toBytes(); pure nothrow safe void write(const(ubyte)[] bytes); ``` so which is standard?
Oct 14 2016