6 ms·
I guess the output is not really meant to be readable in any way
by JyB 5y ago
I guess the output is not really meant to be readable in any way
- em-bee 5y agoif it transpiles to sh then the output should be an sh script. that should be at least somewhat readable.
- xyzzy123 5y agoYes although it might be readable in the same way that autotools configure scripts are readable -- technically you can, but you probably don't want to, and if you need to then something has gone badly wrong.
- em-bee 5y agoyeah, that's kind of what i meant. especially if the script has external commands you should be able to at least recognize something.
- deleted 5y ago[deleted]
- xg15 5y agoI mean yes. Things do go wrong, especially with bleeding-edge projects such as this. You'll have to look at that output if you want to debug things, understand error messages. As such, I'd absolutely see it as a quality measure for a transpiler how readable the code it produces is.
- hnlmorg 5y agoI think you can liken this to web assembly. The output might be text but it’s not intended to be human readable.
- ketralnis 5y agoThat's not a given, think typescript compiling to minified javascript. Some compilers like coffeescript do put in some effort to have the output be readable but I wouldn't assert that it should be a goal for everyone
- eyelidlessness 5y ago> typescript compiling to minified javascript This is an odd example. TypeScript compiles to readable JavaScript for nearly everything except the odd runtime behavior (eg enums) and “downleveling”, which is increasingly unnecessary. Minification is still a separate step AFAIK (if you’re using tsc; obviously ESBuild and SWC are another story, as will be Bun).
- ketralnis 5y agoYou caught me, I've never written typescript. I don't think that changes my claim though
- eyelidlessness 5y agoI think I have varying and stronger feelings about it depending on context. Personally if I were to use this or any compile-to-shell thing, I’d probably prefer it produces unreadable output. I don’t want to ever read bash if I can help it. If I have to, it’s a good sign I’m already beyond my preferred scope for using bash in any way. Whereas if I’m compiling TypeScript/CoffeeScript/anything to JS, it’s pretty likely I already have JS as a built in constraint and I probably want to be able to read the output so I can debug it.
- Brian_K_White 5y agoIt's possible to express many common features and functions of other languages in sh fairly well, so it's probably possible for a tool like this to output something not too bad. But even so, I would never expect any transpilation output to be more than technically readable. The part with the high level meaning is the part the human wrote. That's the entire point of any language. The output can not be considered source, regardless that it's possible to also write source in that same syntax. The only reason to even bother with transpiling instead of just requiring the necessary interpreter, is to ship something that the target already supports. It's very very little different than shipping a binary. The differences are just that a .sh is at least possible to read and hack vs not-possible. Not convenient or good, merely possible vs not-possible. And a .sh is more portable than a binary in that it doesn't care what the cpu or os is. If you want anything more high level meaningful instead of some 90's web page generator html output, you have to write that yourself. An automated tool cannot reverse engineer some code into an elegant expression of the original intent of that code. In that way a compiler or transpiler is not much different from a decompiler. Though, I admit there is room for levels. I don't know just how crude this tool's output is, but I know there is a range of what's possible, it does't have to be
- catlifeonmars 5y agoAlso, source maps a la JavaScript.