JoyOfHardware / FastWave2.0

GNU General Public License v3.0
1 stars 0 forks source link

Remove Bindgen Magic to Enhance Readability #15

Open ThePerfectComputer opened 3 months ago

ThePerfectComputer commented 3 months ago

This line seems to be enabled by bindgen!() magic... Such makes the codebase less readable. Can you re-factor this to get rid of bindgen!() magic, perhaps opting for something a bit more readable/maintainable such as let format_signal_value = instance.get_func(&mut store, "format_signal_value").unwrap().get1::<i32, i32>()?;?

ThePerfectComputer commented 3 months ago

I'm not necessarily against Macros, but this crosses the line IMO. Things are now too hard to trace down for somebody reading/perusing the codebase.

MartinKavik commented 2 months ago

If I'm not wrong while looking at the code on my phone - the method called on that line is generated from the WIT component description by official Rust WIT component tools. The suggested changes would make it much less maintainable because it would ignore best WIT practices and it would break in case of WIT API changes because the macros make it verifiable by Rust compiler. However we can help the reader of the code by changing the component description itself to make the generated code more expressive or at least add some comments or other hints for the reader.

ThePerfectComputer commented 2 months ago

This is understandable. Let me chew on this some more...