spierce7
06/12/2022, 2:10 PMcommon
API that is similar in Java and JS. It involves a tree of content, and each node is exposed through the common API. It’d be nice if I didn’t have to allocate an extra class for each node to properly delegate to each platform (since the trees can be rather large).
Touchlab showed off an interesting approach a few years ago using expect / actual type aliases with extension properties. This doesn’t work in my case because some of the classes in JS aren’t open, or some are interfaces in Java, and classes in JS.
I’m interested if there are any other creative solutions to this that I haven’t thought of.Big Chungus
06/12/2022, 4:02 PMBig Chungus
06/12/2022, 4:02 PMBig Chungus
06/12/2022, 4:02 PMBig Chungus
06/12/2022, 4:04 PMspierce7
06/12/2022, 4:04 PMBig Chungus
06/12/2022, 4:05 PMspierce7
06/12/2022, 4:05 PMBig Chungus
06/12/2022, 4:05 PMspierce7
06/12/2022, 4:07 PMexpect interface HtmlElement
I’m not seeing a way to circumvent the error in the actualBig Chungus
06/12/2022, 4:09 PMBig Chungus
06/12/2022, 4:09 PMspierce7
06/12/2022, 4:14 PMexpect
not to check for `actual`s, and then you tell the `actual`s not to check for `expect`s.
You break the relationship from the compilers perspective, but the result is you can do what you need to in each platform without object allocations.
This is painful. There should be a better user story from a multiplatform perspective to solve this. Thank you for showing me this though!spierce7
06/12/2022, 4:16 PMBig Chungus
06/12/2022, 4:16 PMexpect type XXX
which then can be any kind of type (class, interface, union?)Big Chungus
06/12/2022, 4:16 PM