Skip to content

D guest bindings generator#1561

Draft
QuantumSegfault wants to merge 14 commits intobytecodealliance:mainfrom
QuantumSegfault:dlang
Draft

D guest bindings generator#1561
QuantumSegfault wants to merge 14 commits intobytecodealliance:mainfrom
QuantumSegfault:dlang

Conversation

@QuantumSegfault
Copy link
Copy Markdown

Implements a d subcrate to support generating bindings for the D programming language.

@QuantumSegfault
Copy link
Copy Markdown
Author

This PR is not yet finished. Just opening a draft early to help interested parties keep track.

@alexcrichton
Copy link
Copy Markdown
Member

Thanks! One thing I'd also recommend as you're implementing things is to add D to this enum as well to hook this into the testing infrastructure. You can then add d to this matrix as appropriate with CI-specific steps to setup the compiler and environment. That'll get codegen/runtime tests working and you'll be able to test out your work by dropping files into the tests/runtime/* folder to implement various components. You'll need to write some orchestration for the test runner to know how to compile D programs (you can draw inspiration from how C is organized) too.

Happy to help answer questions about anything in specific if you have them, and if you have any questions about Rust/idioms/etc feel free to leave a comment here and I can dig in. Otherwise I'll leave this be until you're ready, in which case feel free to ping me and I can take a closer look.

@QuantumSegfault
Copy link
Copy Markdown
Author

@alexcrichton

Things are coming along nicely, but there's one question I have so far.

The codegen tests are excellent for verifying the output of generated imports and types bindings.

Problems arise with the testing of the export wrappers. The way I've implemented exports is using D templates, which are not and cannot be semantically analyzed at all until they have been instantiated. Until an implementation is provided, the wrappers can't be tested.

Is this a problem? This gap in the testing? Or are the runtime tests that will be written enough to compensate?

@alexcrichton
Copy link
Copy Markdown
Member

A good question! If I understand the problem right I believe you're looking for this. The --stubs argument to the Rust generator generates a stub implementation of all exports to ensure that they're codegen'd well. That can also be useful from a "getting started with the generated code" perspective. Would something like that make sense for D, and would that solve the problem too?

@QuantumSegfault
Copy link
Copy Markdown
Author

Yeah! That's pretty much the answer I'm looking for. Something that can create a very basic stub (no impl; just declarations of functions and types) that I can pump into the exports wrapper soley for tests. Thanks!

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