Skip to content

Initial rust template generics and template test - #851

Draft
SATVIKsynopsis wants to merge 2 commits into
metacall:developfrom
SATVIKsynopsis:template_test_initial
Draft

Initial rust template generics and template test#851
SATVIKsynopsis wants to merge 2 commits into
metacall:developfrom
SATVIKsynopsis:template_test_initial

Conversation

@SATVIKsynopsis

Copy link
Copy Markdown
Contributor

Description

Added the initial Rust generics template implementation and tests.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation update

Checklist:

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests/screenshots (if any) that prove my fix is effective or that my feature works.
  • I have tested the tests implicated (if any) by my own code and they pass (make test or ctest -VV -R <test-name>).
  • If my change is significant or breaking, I have passed all tests with ./docker-compose.sh test &> output and attached the output.
  • I have tested my code with OPTION_BUILD_ADDRESS_SANITIZER or ./docker-compose.sh test-address-sanitizer &> output and OPTION_TEST_MEMORYCHECK.
  • I have tested my code with OPTION_BUILD_THREAD_SANITIZER or ./docker-compose.sh test-thread-sanitizer &> output.
  • I have tested with Helgrind in case my code works with threading.
  • I have run make clang-format in order to format my code and my code follows the style guidelines.

If you are unclear about any of the above checks, have a look at our documentation here.

@viferga viferga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good kickstart but we have to think yet how to handle templates over types. Either we can use the clang style, like FunctionTemplate and ClassTemplate types, or create a generic type called Template.. or make Function and Class have template types by default.. I am not sure how to handle it in the best way.

We will need a new interface for instantiate the templates too. So we will need some kind of codegen on the loader side.

name: String,
ret: Option<FunctionParameter>,
args: Vec<FunctionParameter>,
#[allow(dead_code)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dead code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i added it temporarily because generics is only used for the template handling flow right now, will remove it once the template representation is fully integrated.

@viferga
viferga marked this pull request as draft August 4, 2026 23:50
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

Successfully merging this pull request may close these issues.

2 participants