Again, great job. You will find more edge cases as you use it more, bugs, tweaks, features, etc
I looked through your
seabang.cpp an noticed a couple of things. I am guessing you are building and testing on Windows machine, may under WSL.
- technically “.exe” is fine on Linux too, unless the machine/OS is setup to recognise and run windows binaries, then there will be an issue.
- you force
g++ when executing the compiler.
for 1) on Mac
.app is the “executable” extension, also on MacOS/Linux you can not run any binary that has not been
chmod a+x code.bin. So maybe the way to address this is to allow “Windows App” & “MacOS App” to adjust output, thgis way you can also compile and runs a Windows
.exe on Linux (for example). Probably the real soluition will come from testing inside a real OS (even if you do that via a VM).
for 2) you can try pick up (or test) the
CPP environment variable first as I know not every system has
g++ as the default C++ compiler. With Linux/BSD I know a
which g++ will also get you a full path to the binary. As another senario here I have OS’s set up that dont use the default
c++ alias), but the ones I use are not always in the same place (
/opt/ , or
/home/) and therefore also not in the
PATH environment variable, so usually I just state where the compiler path is, either with
CPP_PREFIX=/home/rpi/gcc-14/bin if I want to also use that linker or other tools (FYI these are also the default variables tested by the
make tool). Again, some thought and experimentation on a real OS will help out here.
EDIT: This 2) suggestion would actually allow
#!seabang to work with other compiler languages
EDIT2: Optionally, if these two settings are added in, then referencing a
~/.seabang defaults file (in the
home directory) may also be a (good?) idea, although I dont know how useful or easy this is to impliment on a Windows machine (that is not using WSL/Cygwin). Also what about
g++.exe on a non-WSL system … (again, edge cases).
Apart from those two main suggestions, atm I cant really see what else might be needed without actually starting to use it, which is cool
I for one am really glad you chose to do this project for #devember2021 and it turned out to be a relatively simple soulution too, great work and hope to see you back next year with another interesting and useful project.