by vkaku · 4y ago · 0 comments
This sort of code isn't readable, idiomatic nor maintainable.
https://gitlab.com/cznic/tcl/-/blob/master/lib/capi_windows_...
> This sort of code isn't readable, idiomatic nor maintainable
isn't really fair. The original code is hopefully readable, idiomatic and maintainable, and if the transpiler does a correct job, who cares about the output any more than I care about the ugliness of the ASM in my object code when I compile it from source.
Yes, it's true that it doesn't matter if you only want to get the code running in a Go environment for whatever reason. But anyone wanting to learn about TCL or idiomatic Go by reading the source code for this project will be disappointed, and that struck me as the main appeal of this when I saw the headline.
A port would imply and independent maintenance.
Here you wouldn't maintain that codebase, instead you'd fix the upstream or the compiler, and recompile.
Quite the opposite. Port refers to targeting a different environment using the same codebase. The aforementioned ARM port wouldn't require a new codebase to maintain, but rather a new/modified compiler to target the ARM environment. Similarly, a macOS port of Linux software wouldn't require maintaining another codebase, it would require changing the compiler to support a macOS target.
> Here you wouldn't maintain that codebase, instead you'd fix the upstream or the compiler, and recompile.
Exactly. In this case a different compiler that targets the Go environment has been introduced. That does not imply that the compiled output is what should be maintained going forward. You wouldn't maintain the product of an ARM port or macOS port either. It is a port, not a fork. Fork is the word we use when there is implication of independent maintenance.
On extreme end, porting something from let's say Commodore 64 to Spectrum ZX would be more a complete rewrite.
I also don't really understand the point of this project. Since it's compiled from C, it doesn't get any of possible benefits of using a language that is not C.