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

Getting rid of the virtual object base #17

Open
mason-bially opened this issue Apr 26, 2018 · 2 comments
Open

Getting rid of the virtual object base #17

mason-bially opened this issue Apr 26, 2018 · 2 comments

Comments

@mason-bially
Copy link
Contributor

This will significantly improve the ability to inter-operate with our existing C++ code without using compiler support (because virtual inheritance uses the virtual dispatch mechanisms used by functions).

the purpose of Object is really about is a shared header for the object with the following: The root pointer, the type pointer, and memory information. Object is just a pointer and management class around that header.

  • Deal with Aspects:
    Currently aspects expect that they can know the current object (e.g. through the virtual object), to maintain this use templates better. Add back the Implements<SAspect>::For<SomeType> and (through templates or a different name like Inhereting or Subtyping know that you can) use a static_cast<Object*>(static_cast<SomeType*>(this)).
  • Deal with multiple inheritance of base objects:
    Currently this is done with compiler support using virtual inheritance. With the type system we can record a list of Object enabled objects and mutate them before/on construction.
  • Clarify the setup order for instances:
    Construction of header and the memory for the type, then call the initializer (with type dispatch)... if we use placement new and mutate the memory ahead of time we could use constructors as initalizers (might need a check in Object in case some chuckle head calls new on one).
  • Support runtime sized types:
    Allocate the header and object memory at the same time so they are contiguous - with the right template flag on the type - lookup the run time type size.
  • Remove public virtual Object from all the objects, replace with protected Object (or public?) where necessary.

C++ is a powerful statically compiled language that has to keep that power open for the future (e.g. through virtual function tables and virtual base objects being pointers). craft-type is a powerful multi-paradigm helper designed to support dynamic code generation, hence it is designed with the understand that it will always have all the necessary information (because it supports mutating it later).

@mason-bially
Copy link
Contributor Author

The first step is to change instances to be pointers to InstanceHeaders, but not optimized so the value directly follows.

@mason-bially
Copy link
Contributor Author

Types are now using placement new. Now we need some graph properties for all the Object locations.

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

1 participant