wabt icon indicating copy to clipboard operation
wabt copied to clipboard

replace old style union in initializing expression representation with std::variant

Open dbezhetskov opened this issue 3 years ago • 5 comments
trafficstars

Hi, this is just small cleanup. I've replaced union with std::variant to free Type type because now it should be always POD as a member of union. Suddenly, after refactoring I revealed that FuncRef and NullRef cases and Type actually not used in our code so I don't move them into new version of InitExpr.

dbezhetskov avatar Feb 12 '22 07:02 dbezhetskov

Are there any remaining issues with landing this? It would be helpful for completing the implementation of typed funcrefs and also GC support, as it would allow including a Var or similar data in the type.

takikawa avatar Apr 05 '22 02:04 takikawa

Are there any remaining issues with landing this? It would be helpful for completing the implementation of typed funcrefs and also GC support, as it would allow including a Var or similar data in the type.

It looks like this actually has to be rebased to be mergeable now, since the relevant file has been updated recently. I can work on rebasing this

takikawa avatar Apr 05 '22 18:04 takikawa

I've rebased this now on this branch https://github.com/takikawa/wabt/commit/904827773db8764f27c6a356bcc7699fffe864ae

@dbezhetskov could you update your PR branch with this commit and re-push? Thanks.

takikawa avatar Apr 05 '22 18:04 takikawa

I've updated the branch, thanks @takikawa

dbezhetskov avatar Apr 07 '22 06:04 dbezhetskov

This seems like a smart change for the reasons @takikawa mentioned. I personally don't really like using std::visit and overloaded very much since it is a little complex, and would prefer using a switch/index instead. But it's mostly just a personal opinion, and I see that using overloaded does provide better type safety.

I think I agree. I prefer the old switch style. Especially if that allows use to avoid adding all those new struct types.

sbc100 avatar Apr 18 '22 17:04 sbc100

In the interests of trying to clean up the PR backlog -- is there still interest in pursuing this (subject to comments) or is this ok to close?

keithw avatar Feb 09 '23 02:02 keithw

Hi @keithw, thanks for checking in. I personally don't have the bandwidth to pursue this currently and am ok with closing it. WDYT @dbezhetskov?

takikawa avatar Feb 09 '23 21:02 takikawa

The same for me, feel free to close this.

dbezhetskov avatar Feb 10 '23 07:02 dbezhetskov

Thanks for the quick responses! OK, closing for now.

keithw avatar Feb 10 '23 07:02 keithw