This would have to be backend-specific, but it would be nice to be able to overload across FFI where possible.
Instead of a #[diplomat::overload] attribute, the design I'm thinking would be #[diplomat::rename(cpp, "foo_bar")] (renaming is useful anyway), and in case of clashes, the backend figures out if stuff is overloadable and handles it if so.
For example, in C++ stuff is overloadable as long as the signatures are different. In JS, you can overload different structs provided they have different fields (this is similar to typescript | sum types), or if the types are different enough. The C backend is raw FFI so I'd prefer to not have overloading at all.
I can imagine constructors (#166) being handled with rename(constructor) or something
Related: https://github.com/rust-diplomat/diplomat/issues/166
This would have to be backend-specific, but it would be nice to be able to overload across FFI where possible.
Instead of a
#[diplomat::overload]
attribute, the design I'm thinking would be#[diplomat::rename(cpp, "foo_bar")]
(renaming is useful anyway), and in case of clashes, the backend figures out if stuff is overloadable and handles it if so.For example, in C++ stuff is overloadable as long as the signatures are different. In JS, you can overload different structs provided they have different fields (this is similar to typescript
|
sum types), or if the types are different enough. The C backend is raw FFI so I'd prefer to not have overloading at all.I can imagine constructors (
#166
) being handled withrename(constructor)
or something