-
Notifications
You must be signed in to change notification settings - Fork 321
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
Allow forward declaring a type outside the present namespace #1079
Comments
I was following along until the custom alias part. 😀 Can you post a more concrete example with an alias interaction. Feel free to make up syntax. That will help me understand this pain point better. Thanks! |
I use a custom alias to define what "handle" is. It actually gets serialized/deserialized as a scalar type, but I want the generated structures to contain the "bar.ext" object. The aliased type on one side is a pointer, so it doesn't need to be defined, and the aliased type on the other side is a generic template that doesn't care about the actual type. Presently, I can accomplish the above by creating a separate "bond" file that declares a namespace "bar" and then forward declares an object "ext". This gets tedious when defining multiple types in multiple namespaces. |
Gotcha. Thanks! gbc could be extended to understand that something like There appears to be a bug in the implementation of However, in struct/enum/view definitions, the name is parsed by Thus, a proper implementation of This isn't something that we need inside of Microsoft; we won't be implementing it any time soon. You are welcome to contribute it. Related: Issue #359, "Multiple Namespaces per IDL file" That issue mentioned that support for multiple namespaces could not be added there was internal Microsoft tooling that wouldn't be able to handle such a change. That tooling is still around, but in the three years since that issue was opened, its use has declined enough that maintaining backward compatibility with it is probably no longer needed. This change would be similar. |
Thanks. This issue is less important to us as well. I'll keep it open for anyone curious in the future and maybe by that time I'll find a way to contribute. |
Since bond files can only declare a single namespace, forward declaring objects in other namespaces becomes tedious. While it may seem odd to need to forward declare an object in another namespace, when using custom aliases, the type may never be defined in bond. However, to keep the bond compiler happy, the type must exist.
An alternative would be to allow a scoped namespace declaration.
The text was updated successfully, but these errors were encountered: