ta0kira / zeolite

Zeolite is a statically-typed, general-purpose programming language.
Apache License 2.0
18 stars 0 forks source link

Allow C++ extensions to use internal `refines` and `defines`. #192

Closed ta0kira closed 2 years ago

ta0kira commented 2 years ago

There isn't currently a way for a C++ extension to hide interface inheritance. It was possible before streamlined extensions because the dispatching code wasn't actively generated.

This is really only useful where the extension passes self to another function, e.g., a visitor.


This would probably need to be a new section in .zeolite-module. It doesn't really belong in category_source because the latter can define multiple categories.

For example:

category_internals: [
  category {
    name: Foo  // Not sure if the param should be included here.
    refines: []
    defines: [
      Equals<Foo<#x>>
      LessThan<Foo<#x>>
    ]
  }
]

To actually execute:

  1. Code generation would need to be updated, e.g., StreamlinedExtension in CompilerCxx.CxxFiles.
  2. Inherited categories need to be type checked. This could be done with a mostly-empty DefinedCategory passed to mergeInternalInheritance. The updated category map would then be needed when generating the code.