digitalmars.D.learn - Access private member
- Pierre (6/6) Jun 13 2016 Hi,
- Jacob Carlborg (4/10) Jun 13 2016 For fields, used .tupleof, for other symbols, use a pointer.
- Jacob Carlborg (11/12) Jun 13 2016 Here's an example [1] of accessing a field using the name of the field
- Basile B. (10/20) Jun 13 2016 There's also the IZ serializer. It's based on accessors (called
- Basile B. (3/9) Jun 13 2016 You can perform the introspection in the class itself, e .g in
- Pierre (1/1) Jun 13 2016 Thank you i will try it.
- Jacob Carlborg (7/8) Jun 13 2016 You don't need to involve the constructor. You can use .tupleof, as I
- Basile B. (6/12) Jun 13 2016 I understand that web devels needs to dump 47 bytes and send them
- Basile B. (5/19) Jun 13 2016 oops I think I've replied to another thread on another board :/
- Basile B. (3/23) Jun 13 2016 https://www.youtube.com/watch?v=YJO4-aa6PCI&list=PLuhnsen8iS5ltHofd21TWB...
- Jacob Carlborg (8/11) Jun 13 2016 Yes, I've written Orange and proposed it to Phobos. Not sure what you
Hi, I would like to know how can i access private member of class from outside ? I think about serialization for instance, serializer must have access to protected attributes. How this is done ? Thank you.
Jun 13 2016
On 2016-06-13 09:43, Pierre wrote:Hi, I would like to know how can i access private member of class from outside ? I think about serialization for instance, serializer must have access to protected attributes. How this is done ? Thank you.For fields, used .tupleof, for other symbols, use a pointer. -- /Jacob Carlborg
Jun 13 2016
On 2016-06-13 09:49, Jacob Carlborg wrote:For fields, used .tupleof, for other symbols, use a pointer.Here's an example [1] of accessing a field using the name of the field as a string. It will bypass private. That module [1] contains some generic functionality for working with fields which you would need for serialization. Or you can use the whole serialization library directly [2] ;) [1] https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L123 [2] https://github.com/jacob-carlborg/orange -- /Jacob Carlborg
Jun 13 2016
On Monday, 13 June 2016 at 07:53:08 UTC, Jacob Carlborg wrote:On 2016-06-13 09:49, Jacob Carlborg wrote:There's also the IZ serializer. It's based on accessors (called property descriptor) to read and write private or protected fields. Actually it's never a good idea to directly access them. Usually they're not hidden for anything (e.g the count of items in a list, the setter update the list...) pd: https://github.com/BBasile/iz/blob/master/import/iz/properties.d ser: https://github.com/BBasile/iz/blob/master/import/iz/serializer.dFor fields, used .tupleof, for other symbols, use a pointer.Here's an example [1] of accessing a field using the name of the field as a string. It will bypass private. That module [1] contains some generic functionality for working with fields which you would need for serialization. Or you can use the whole serialization library directly [2] ;) [1] https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L123 [2] https://github.com/jacob-carlborg/orange
Jun 13 2016
On Monday, 13 June 2016 at 07:43:09 UTC, Pierre wrote:Hi, I would like to know how can i access private member of class from outside ? I think about serialization for instance, serializer must have access to protected attributes. How this is done ? Thank you.You can perform the introspection in the class itself, e .g in the __ctor.
Jun 13 2016
On 2016-06-13 09:54, Pierre wrote:Thank you i will try it.You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1] http://forum.dlang.org/post/njlohq$1n99$1 digitalmars.com [2] http://forum.dlang.org/post/njlop0$1ngk$1 digitalmars.com -- /Jacob Carlborg
Jun 13 2016
On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote:On 2016-06-13 09:54, Pierre wrote:I understand that web devels needs to dump 47 bytes and send them at 8759 miles in 200 ms, but this serialization scheme is not good for object streaming, e.g store a full GUI in a resource file. Nobody will ever use flatbuffer or message pack to store a GUI...lol.Thank you i will try it.You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1] http://forum.dlang.org/post/njlohq$1n99$1 digitalmars.com [2] http://forum.dlang.org/post/njlop0$1ngk$1 digitalmars.com
Jun 13 2016
On Monday, 13 June 2016 at 14:30:13 UTC, Basile B. wrote:On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote:oops I think I've replied to another thread on another board :/ Unless It's you Jacob who have proposed Orange to phobos in 2012. And then since refused it's not developed at all. IIRC it's even not possible to compile it with DUB.On 2016-06-13 09:54, Pierre wrote:I understand that web devels needs to dump 47 bytes and send them at 8759 miles in 200 ms, but this serialization scheme is not good for object streaming, e.g store a full GUI in a resource file. Nobody will ever use flatbuffer or message pack to store a GUI...lol.Thank you i will try it.You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1] http://forum.dlang.org/post/njlohq$1n99$1 digitalmars.com [2] http://forum.dlang.org/post/njlop0$1ngk$1 digitalmars.com
Jun 13 2016
On Monday, 13 June 2016 at 15:00:06 UTC, Basile B. wrote:On Monday, 13 June 2016 at 14:30:13 UTC, Basile B. wrote:https://www.youtube.com/watch?v=YJO4-aa6PCI&list=PLuhnsen8iS5ltHofd21TWBx-bqmR9V8RU&index=14&nohtml5=False now you know the origin of the hat ;)On Monday, 13 June 2016 at 11:27:31 UTC, Jacob Carlborg wrote:oops I think I've replied to another thread on another board :/ Unless It's you Jacob who have proposed Orange to phobos in 2012. And then since refused it's not developed at all. IIRC it's even not possible to compile it with DUB.On 2016-06-13 09:54, Pierre wrote:I understand that web devels needs to dump 47 bytes and send them at 8759 miles in 200 ms, but this serialization scheme is not good for object streaming, e.g store a full GUI in a resource file. Nobody will ever use flatbuffer or message pack to store a GUI...lol.Thank you i will try it.You don't need to involve the constructor. You can use .tupleof, as I mentioned [1] [2]. [1] http://forum.dlang.org/post/njlohq$1n99$1 digitalmars.com [2] http://forum.dlang.org/post/njlop0$1ngk$1 digitalmars.com
Jun 13 2016
On 2016-06-13 17:00, Basile B. wrote:Unless It's you Jacob who have proposed Orange to phobos in 2012. And then since refused it's not developed at all. IIRC it's even not possible to compile it with DUB.Yes, I've written Orange and proposed it to Phobos. Not sure what you mean with "refused" and "not developed". Orange is a part of Mambo [1] which is avilable using Dub [2]. [1] https://github.com/jacob-carlborg/mambo/tree/master/mambo/serialization [2] http://code.dlang.org/packages/mambo -- /Jacob Carlborg
Jun 13 2016