-
Notifications
You must be signed in to change notification settings - Fork 8
Description
There should be no technical reason to have 1:1 mapping between Rust and COM parameters. We are already coming up with COM OUT values based on Rust return types.
We could further skip some of the Rust method parameters on the COM level and fill these in by Intercom.
The primary (and for now only) use case for this would be the type system argument. Being able to tell what type system is being used to invoke a function has immediate use case in writing unit tests for Intercom itself. But it would also be required if someone wants to write methods by managing interface pointers, etc. themselves.
The big open question here is what kind of marker we'll want for such parameters. Below are some options in terms of the intercom::TypeSystem enum.
/// Assume certain types are always contextual types.
fn foo( &self, ts : intercom::TypeSystem );
/// Require an attribute on the parameter.
fn foo( &self, #[intercom::context] ts : intercom::TypeSystem );
/// Use a generic type instead.
fn foo( &self, ts : intercom::CallContext<intercom::TypeSystem> );Personally I'm in favor of the first one. Intercom needs to be aware of these types anyway and as such we can be certain that these types are not COM-compatible (no #[repr(C)]).
The one dirty aspect with this is that when Rust wants to call such COM methods, there's no clean way to communicate to the caller that these things are not needed...
Although things like ts should probably affect the preference of which TS to use in case the ComItf we are using to call these methods happens to have both Automation and Raw interfaces available. Though is it an error if the asked interface is not available? There's no real TypeSystem::Any variant and we don't want one for output purposes.