3 ms·
Because doing so would be hard for shell scripts to express. real functions, try/catch, and other common language features are not often part of shell language
by cdaringe 7y ago
Because doing so would be hard for shell scripts to express. real functions, try/catch, and other common language features are not often part of shell languages. As such, the generated code may not support many features you typed in <other lang> and/or the generated code would bundle a runtime with it to emulate what we'd otherwise consider pragmatic scripting feature support.
- derefr 7y agoI mean, like I said, I don’t want to use $lang features that don’t exist in shell script. E.g., I want “exceptions” in the sense that adding a string-typed variable to an integer-typed variable will blow up in a descriptive way (or better, not compile); but I don’t want real exceptions in the sense of being able to catch them. I just want everything to translate to the shell script aborting in verbose and helpful ways before doing something stupid with invalid inputs; or not compiling at all if there’s a code-path that can’t possibly be valid. Also, I wouldn’t mind if this $lang that compiles to shell script is its very own language I’d have to learn, just like TypeScript is its very own language you have to learn. As long as I don’t have to manually write five layers of guards using impenetrable [ “y${x:-1}” -eq “f” ] style code, and then duplicate the hierarchy of cleanup behaviours after each failed guard, I’d be happy.