Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This was written by matz some time between 1993 and 1994. It appeared in the very first preview release of ruby, version 0.49. The original tarball has the file modification timestamps:

    $ curl -s https://cache.ruby-lang.org/pub/ruby/1.0/ruby-0.49.tar.gz | tar -tvz | grep dir.rb
    -rw-r--r--  0 matz   root      127 Jun  3  1994 ruby/sample/dir.rb


Fun retrocomputing diversion: Initial Ruby development was done on Sony NEWS, the same type of workstation that hosted the earliest PlayStation development boards: https://en.wikipedia.org/wiki/Sony_NEWS


Hilarious origin story of Sony NEWS, how the engineers built a UNIX workstation they wanted, not what they were told to build.

> Sony's NEWS project leader, Toshitada Doi, originally wanted to develop a computer for business applications, but his engineers wanted to develop a replacement for minicomputers running Unix that they preferred to use.

> In the beginning, Doi's concept of the workstation was a device, which was essentially an extension of current [MIPS (Media Information Products and System) Business Group] projects. He saw it as consisting of "a 32-bit CPU developed in a short time with unrestricted applications." Basically, he thought of it as an OA computer.

> However, the engineers Doi selected for his team did not listen to what Doi told them to do. They wanted to develop a workstation that could replace the VAX Super Mini Computer developed by Digital Equipment Corp. (DEC). This was a computer that the engineers often fought with each other to use while at MIPS because of the limited number. They wanted to develop something they themselves could use for their own day to day work.


That file is very different with an added rewind and now case/when.

    dirp = Dir.open(".")
    dirp.rewind
    for f in dirp
      if (~/^\./ || ~/~$/ || ~/\.o/)
      else
        print(f, "\n")
      end
    end
    dirp.close


   if (~/^\./ || ~/~$/ || ~/\.o/)
ah, the perl heritage is strong here!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: