3 ms·
As developer that does not know how to write Bash scripts at all but is well versed in Swift, if I have to write such a tool, I'd rather use such "suboptimal" o
by DeusExMachina 8y ago
As developer that does not know how to write Bash scripts at all but is well versed in Swift, if I have to write such a tool, I'd rather use such "suboptimal" option than have to learn a new language.
It also has the advantage that, if later this solution needs to grow past a simple command line tool, I can just grab the Swift code from the script, put it in an Xcode project, and make a Mac app out of it.
- wool_gather 8y agoIt takes a while, like anything, to get comfortable with shell scripts, but it's absolutely a tool that every programmer should have basic familiarity with. It's universal glue. And in the domains where shell is a good choice, it's a far far better choice than Swift. Maybe that will change, but I doubt it. I've implemented a couple of medium-small tools over the last two years and as an exercise did them in both shell and Swift. The shell versions are simpler, more maintainable, and more robust than the Swift versions. Swift's verbose "correctness" is not an asset in the domain(s) where scripting is useful. Gluing programs together is one. Frankly, text processing is another. An invocation of sed with a simple regex becomes a monstrosity when translated to Swift. The less code you write, the less you have to maintain.
- saagarjha 8y ago> An invocation of sed with a simple regex becomes a monstrosity when translated to Swift. This is because Swift’s regex support is overly verbose, being lifted straight from Objective-C. It’s not an inherent problem when the language.
- bexsella 8y agoAgreed, along with basic familiarity with vi/vim this is almost required knowledge if you're deploying to or working on a system other than Windows or MacOS.
- wool_gather 8y agoIt definitely applies to Mac as well; it's got a full complement of BSD command line goodies.