Ruby if no input

Hi!

I’ve seen a great idea in pike (not a big one, but helps beginners…)

If you start the language without any file, and input is terminal, the
interactive system should start.

Any comments?

Gergo

±[Kontra, Gergely @ Budapest University of Technology and Economics]-+

    Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu          |

URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
±------“Olyan langesz vagyok, hogy poroltoval kellene jarnom!”-------+
.
Magyar php mirror es magyar php dokumentacio: http://hu.php.net

Kontra, Gergely wrote:

Hi!

I’ve seen a great idea in pike (not a big one, but helps beginners…)

If you start the language without any file, and input is terminal, the
interactive system should start.

Any comments?

This is quite common (see e.g. hugs).

Ruby also reads from stdin if started without a file, this is of
course not too helpful for a beginner, but allows for using it as a pipe.
I think this is the optimal way a scripting language should behave.

Regards, Christian

Christian Szegedy wrote:

Ruby also reads from stdin if started without a file, this is of
course not too helpful for a beginner, but allows for using it as a pipe.
I think this is the optimal way a scripting language should behave.

It could actually do both. If stdin is a tty then it could give an
interactive session, otherwise fall back to the old behavior.
I think there are some examples of programs doing this, but I can’t
think of one right now.

/Anders

···

A n d e r s B e n g t s s o n | ndrsbngtssn@yahoo.se
Stockholm, Sweden |


Gratis e-mail resten av livet på www.yahoo.se/mail
Busenkelt!

Ruby also reads from stdin if started without a file, this is of
course not too helpful for a beginner, but allows for using it as a pipe.
I think this is the optimal way a scripting language should behave.

lizzy:~% python
Python 2.2.1 (#1, Apr 20 2002, 10:26:30)
[GCC 2.95.3 20010315 (release)] on freebsd5
Type “help”, “copyright”, “credits” or “license” for more information.

How about

lizzy:~% ruby
ruby(main):001:0>

?

···

On Fri, Oct 04, 2002 at 11:48:02PM +0900, Christian Szegedy wrote:


Jos Backus / /// Sunnyvale, CA
_/ _/ _/
/ ///
_/ _/ _/ /
jos at catnook.com // //
/ require ‘std/disclaimer’

Anders Bengtsson ndrsbngtssn@yahoo.se writes:

Christian Szegedy wrote:

Ruby also reads from stdin if started without a file, this is of
course not too helpful for a beginner, but allows for using it as a pipe.
I think this is the optimal way a scripting language should behave.

It could actually do both. If stdin is a tty then it could give an
interactive session, otherwise fall back to the old behavior.
I think there are some examples of programs doing this, but I can’t
think of one right now.

bash and tcsh, i would say. and gnuplot.

/Anders

regards
messju

lizzy:~% python
Python 2.2.1 (#1, Apr 20 2002, 10:26:30)
[GCC 2.95.3 20010315 (release)] on freebsd5
Type “help”, “copyright”, “credits” or “license” for more information.

How about

lizzy:~% ruby
ruby(main):001:0>

?

% irb
Reading config file… done.
ruby-1.7.3 on i586-pc-linux with irb 0.9(02/07/03)
Type ‘help’ for more information.

quit
Time spent with irb: 00:00:01.
% _

http://hacker.pl/gminick/pliki/old/tools/irbrc.rb

···

On Sat, Oct 05, 2002 at 03:59:05PM +0900, Jos Backus wrote:


[ Wojtek gminick Walczak ][ http://gminick.linuxsecurity.pl/ ]
[ gminick (at) hacker.pl ][ gminick (at) underground.org.pl/ ]