Hacker News new | past | comments | ask | show | jobs | submit login

It sounds like we do very similar jobs and feel the same way about Python. I'm 97% sure you're going to stick with your own language, but for others seriously give Ruby a look.

I absolutely adore Ruby as a scripting language. It's so easy and elegant to shell out to bash and do something with the output. When brevity or familiarity with bash is desired, variables like $? are there also (although there are generally less esoteric ways to do things). Running a simple shell command in Ruby is as easy as using backticks and having the output from the command returned to you as a String (and I always add a .chomp to strip the trailing \n)[1] Example: datestr = `date '+%Y-%m-%d-%H-%M-%S'`.chomp

Worth noting too is that Ruby also has a fantastic one-liner command line syntax like perl and awk for example. Check out https://robm.me.uk/2013/11/ruby-enp/ and https://benoithamelin.tumblr.com/ruby1line/

Also the community is amazing. There are gems for almost everything, and really neat/fun projects like Ruby Warrior: https://github.com/ryanb/ruby-warrior

I'll stop now, but suffice it to say Ruby is one of the best tool sin my belt, and I haven't even mentioned the number of times I've thrown down a simple single-file HTTP service based on Sinatra in record time ;-)

[1] https://stackoverflow.com/a/2400/2062384




> I'm 97% sure you're going to stick with your own language

Agree with the estimation :)

> but for others seriously give Ruby a look

Of course. Python is not out of the question either. I think it's mostly about alignment of how you think and what is possible to express in the language in a straightforward manner.

> It's so easy and elegant to shell out

That's the area where I think NGS has better facility than pretty much anything else I've seen out there. In NGS, it's the "domain". From the top of my head:

  * Short syntax for run-the-command-and-parse-output (currently auto detects JSON but customizable) - like backticks in bash but double-backtick on each side.
  * backticks syntax like in bash (but don't strip the last newline)
  * Argv facility for constructing command line arguments (if the command is complex)
  * Automatic handling of exit codes. Errors throw exceptions and no, not any non-zero is an error.
  * ok: option to specify non-error exit codes for particular run of a program
  * log: option to log the command being run
More at https://github.com/ngs-lang/ngs/wiki/Use-Cases#use-case-ops-...

> Worth noting too is that Ruby also has a fantastic one-liner command line syntax like perl and awk for example.

NGS is somewhat there and somewhat getting there




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: