gtk-rs-core icon indicating copy to clipboard operation
gtk-rs-core copied to clipboard

[PROPOSAL] Consider moving some/all of glib::wrapper to a proc macro

Open jf2048 opened this issue 2 years ago • 2 comments

Altogether these macros are huge, it is difficult to add features or refactor them. Every new argument must put through around 6-8 pattern matches to work, see for example some of the changes here: https://github.com/gtk-rs/gtk-rs-core/pull/609/commits/3c41d6deaa2f4c7c7d726c1f124998f52ba31762

If we ever want to add support for lifetimes and PhantomData that will need to have all the macros changed again as per https://github.com/gtk-rs/gtk-rs-core/issues/610#issuecomment-1272370600.

jf2048 avatar Jan 21 '23 21:01 jf2048

@GuillaumeGomez is talking about that since quite some time, just nobody got to it yet :)

sdroege avatar Jan 21 '23 22:01 sdroege

Tried out here https://github.com/gtk-rs/gtk-rs-core/pull/970/commits/cc620d4f9e3fabf78394ed184e850c144b3bcb6f but it seems around 15% - 20% slower than the macro_rules implementation. Not sure what the cause of the slowness is, if it is avoidable or if it is just overhead from the proc macro bridge

jf2048 avatar Feb 15 '23 17:02 jf2048