Live data from Hacker News

Rubish: A Unix shell written in pure Ruby

github.com

31–40 of 111 posts

Re: Rubish: A Unix shell written in pure Ruby

#32
I'm recently seeing more and more Ruby projects that are at least partly vibe-coded, and I'm kind of torn. On the one hand I appreciate that this allows people to create stuff that they maybe wouldn't have the time to do otherwise. On the other, the code itself makes it harder for people to contribute, especially those, like me, who don't use coding agents.

A random example:

https://github.com/amatsuda/rubish/blob/master/lib/rubish/pa...

Where are the interface boundaries? Why are there methods that are 200 lines long? This is not a dis at the author, and it's not really about "code quality" per se, whatever that means. It's just that if someone would like to study the code and be able to improve it or add features, how would one go about it? Does this mean you have to use a coding agent in order to contribute? I felt the same about the recent Ruby compiler from matz [1]. The code looks impenetrable. What does this bode for the future of OSS?

[1] https://github.com/matz/spinel

Re: Rubish: A Unix shell written in pure Ruby

#33

People think Ruby is a slow language, but little do they know Ruby is a slower language than Go. But ruby these days is faster than Python.

The speed argument never convinced me in general, in that whether it is perl, ruby or python, they are all slower than C. So the comparisons really are odd to me. The "scripting" languages should of course not try to be slow, but people rarely use them for speed-reasons; they use these languages for gains in productivity and ease of writing code, adding features and so forth. That should be the primary focus point. I…

slow is relative and frequently irrelevant. If you're just always waiting for network, or for results from postgres or redis or something, then a 100x speedup in your code won't change the user experience. And if you're doing computationally hard work in ruby or especially python, you're doing it wrong because either someone already wrote a native library to do it or you should.

Re: Rubish: A Unix shell written in pure Ruby

#34

Tangential: I would love to see more interpreted languages offer shells with native constructs for operating as daily drivers shells (not just REPLs). When I first started learning Ruby I used `rush`[0] as my main shell. Being immersed in the language, even if there were a few helpers for shell operations, really helped me reason better about Ruby and think in the language. `scsh`[1] was enlightening as well. Ultimat…

Not sure if this is related, but i'd love to see more scripting languages (mostly Python) offer facilities which let them take over from shell script for more scripts and one-liners.

Think about what it would take to write this in Python right now:

  for wmv_file in $(find $1 -name '*.wmv'); do
    echo -n "${wmv_file} "
    ffmpeg -i $wmv_file ${wmv_file%.wmv}.mpg 2>&1 | grep kb/s: || echo "ERROR $?"
  done
With a few handy variables and functions predefined, this could be something like:

  for wmv_file in find(argv[1], glob="\*.wmv"):
    print(wmv_file, end=" ")
    result = do("ffmpeg", "-i", wmv_file, basename(wmv_file, ".wmv") + ".mpg")
    if result: print(grep(str(result), "kb/s:"))
    else: print("ERROR", result.status)

Re: Rubish: A Unix shell written in pure Ruby

#35
post #34

Tangential: I would love to see more interpreted languages offer shells with native constructs for operating as daily drivers shells (not just REPLs). When I first started learning Ruby I used `rush`[0] as my main shell. Being immersed in the language, even if there were a few helpers for shell operations, really helped me reason better about Ruby and think in the language. `scsh`[1] was enlightening as well. Ultimat…

Not sure if this is related, but i'd love to see more scripting languages (mostly Python) offer facilities which let them take over from shell script for more scripts and one-liners. Think about what it would take to write this in Python right now: for wmv_file in $(find $1 -name '*.wmv'); do echo -n "${wmv_file} " ffmpeg -i $wmv_file ${wmv_file%.wmv}.mpg 2>&1 | grep kb/s: || echo "ERROR $?" done With a few handy var…

have you seen https://sh.readthedocs.io/en/latest/

Re: Rubish: A Unix shell written in pure Ruby

#36
post #32

I'm recently seeing more and more Ruby projects that are at least partly vibe-coded, and I'm kind of torn. On the one hand I appreciate that this allows people to create stuff that they maybe wouldn't have the time to do otherwise. On the other, the code itself makes it harder for people to contribute, especially those, like me, who don't use coding agents. A random example: https://github.com/amatsuda/rubish/blob/ma…

It's especially unfortunate because there are great tools (like rubocop) that coding agents can respond to, and actually generate very readable, maintainable, and contributable code.

I think this will improve, but I also think your comment is important for people using agents to read. Speaking for myself, I want people like you to be able to read/understand/contribute to my projects should you desire, so this is a great reminder for me.

Re: Rubish: A Unix shell written in pure Ruby

#37

Hmm. The name is a bit awkward since people can call it "rubbish". The idea is also not quite new in that many years ago people worked on an ruby-like shell with OOP support from the get go and they used a ncurses drop down box too. I forgot the name, but it must have been before 2010 already, as I vaguely remember it from talking on IRC back in those days. I think the main developer was from South Africa, but I don'…

> Rails is also ancient already. I think Rails both boosted Ruby and killed it. When I ask people about why they dislike Ruby it's usually due to something specific to Rails (plus some comments around syntax which are easily dismissed or accepted). I used to be a pretty heavy Ruby user and I still love the language, though I have only used Rails sparsely and not by choice. I had the opportunity to work on a Ruby proj…

Indeed, I love Ruby, I find rails to be adequate and powerful, but it largely feels like a different language to me. Rails is so heavy on the "magic" while regular Ruby typically isn't. I use ruby a ton for scripts and small applications (especially micro-services in Sinatra) and it's so readable, expressive, and understandable, often even to people who don't know ruby all that well!

Re: Rubish: A Unix shell written in pure Ruby

#38
post #32

I'm recently seeing more and more Ruby projects that are at least partly vibe-coded, and I'm kind of torn. On the one hand I appreciate that this allows people to create stuff that they maybe wouldn't have the time to do otherwise. On the other, the code itself makes it harder for people to contribute, especially those, like me, who don't use coding agents. A random example: https://github.com/amatsuda/rubish/blob/ma…

Well it may not life up to uncle Bob's clean code standards but it does fit the repo's name, doesn't it?

Re: Rubish: A Unix shell written in pure Ruby

#39
I'm simultaneously amazed and horrified (by the strange but amazing love child you've created between bash and ruby). I spent years (nearly a decade) trying to blend ruby and bash to make the perfect shell, and after never being quite satisfied, I eventually gave up and embraced bash. This does get closer/further than I ever could, and is a fascinating project. I'm going to give it a spin, though I can already imagine the biggest obstacle I'll hit: rubish not being available in the remote environments I need it to, meaning I'll either have to install it (and it's not lightweight currently), or I'll have to live in two different worlds, which isn't usually sustainable.

Kudos though, and great work! I can tell you put a lot of thought and effort into it.

Re: Rubish: A Unix shell written in pure Ruby

#40
post #32

I'm recently seeing more and more Ruby projects that are at least partly vibe-coded, and I'm kind of torn. On the one hand I appreciate that this allows people to create stuff that they maybe wouldn't have the time to do otherwise. On the other, the code itself makes it harder for people to contribute, especially those, like me, who don't use coding agents. A random example: https://github.com/amatsuda/rubish/blob/ma…

I think i can handle this code by hand in fact it’s better than code I have handled by hand. (at a cursory glance.)

In my day - I think it was around 2000 – I was handed a 5000 line perl script that both responded to CGI bin requests to run a store and kicked off fulfillment of the orders. Inside that script, it had two 1500 line long subroutines that sometimes navigated internally via goto.

We refactored, and added new features while a profitable business ran on top of the code. You don’t get quite the velocity you do on good code, but it’s manageable.

Post reply on HN