Giter Site home page Giter Site logo

Comments (4)

stephenberry avatar stephenberry commented on June 9, 2024

I think this is an awesome approach, thanks for all your work on this! I'm planning to add support once some other features and fixes are completed, or I would be happy to merge a pull request.

I do think it would be a good idea to add a compile time option to disable private access for those who do not want it (or deem it dangerous). I think once the feature is implemented it will be more obvious where this should go.

from glaze.

stephenberry avatar stephenberry commented on June 9, 2024

@schaumb, I'm sure you've seen this post about a C++20 approach to private access: https://dfrib.github.io/a-foliage-of-folly/

I like how this approach does not use the stateful meta programming (tag approach). I'm curious what you think about this approach.

I experimented with private access support and I've decided to hold back from including it in Glaze directly. Libraries like yours can be used with Glaze (lambda wrappers in glz::meta are one approach), to expose private variables where needed.

Adding support directly within Glaze would reduce boilerplate, but it would make it so clean that I feel uncomfortable bypassing an intended design feature of C++. It is better to encourage users to use public APIs, accessors, and other intended design features normally.

I do think accessing private members is fantastic for certain use cases, such as third party library serialization, and for debugging. But, realizing that I could just bring in a library like yours and use it with Glaze makes me less inclined to add it here.

Thanks for your research and work into this!

from glaze.

schaumb avatar schaumb commented on June 9, 2024

Thanks for the link @stephenberry !

I didn't know this article before. The main concept behind my access_private_20 project is that no macros are needed for the members (unlike the original access_private and the linked accessprivate), and the interface is unified to one definition: access_private::access<MPTR> (no const diff, etc).

These are impossible without the friend injection, or the name duplication (pre/post function declaration).

from glaze.

stephenberry avatar stephenberry commented on June 9, 2024

Makes sense, I really like your implementation and it being macro free. Your approach should get even cleaner when we get reflection in C++.

from glaze.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.