@abstractxan In my experience, a port is a series of text operations than turn code of one syntax to that of another— followed by operations to swap out dependencies. Some text transformations can be automatic, but often it’s a manual (but systematic) process. It helps when the original project is somewhat modular, because you can then transform one module at a time.
@abstractxan Often, you also need to make a “shim”— a layer of code that gives the ported code familiar functionality similar to an original dependency. For instance, Verreciel was originally built in Apple’s SceneKit, and used the SCNTransaction to smoothly animate rotations and colors. The browser and three.js have animation features, but they’re nothing like SCNTransaction, so I had to shim it.
That was pretty fun actually!
@rezmason Doesn't that mean one needs to understand the ins and outs of all the dependencies?
Though this could be checked with the progress of the porting via the output. Isn't this way too manual?
FOLLOW UP So 'porting' include a lot of studying about the insides of libraries ?
@abstractxan It all comes down to luck, really. Some dependencies have common APIs that map easily to other libraries. Some libraries are available for multiple platforms, and expose identical APIs. A shim should be as small as possible. SCNTransaction is just an oddball API.
In fact, I've entertained the idea of refactoring Verreciel's UI to be declarative, like an SVG type thing, to get away from its dependency on the animation system. But a post-port refactor is complicated.
@abstractxan Once a ported codebase is refactored, the relationship between the port and three original project becomes more distant. If there port is the official remake, then that's fine, but if the original project continues, it can feel like, I dunno, code estrangement. Speciation. Whereas the original aim of a port is to be faithful to the original. 🤷♂️ I overthink this part often
Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.