[#83328] tcltklib and not init'ing tk — aakhter@... (Aamer Akhter)

Hello,

13 messages 2003/10/01

[#83391] mixing in class methods — "Mark J. Reed" <markjreed@...>

Okay, probably a dumb question, but: is there any way to define

22 messages 2003/10/01
[#83392] Re: mixing in class methods — Ryan Pavlik <rpav@...> 2003/10/01

On Thu, 2 Oct 2003 06:02:32 +0900

[#83397] Re: mixing in class methods — Gavin Sinclair <gsinclair@...> 2003/10/01

On Thursday, October 2, 2003, 7:08:00 AM, Ryan wrote:

[#83399] Re: mixing in class methods — "Mark J. Reed" <markjreed@...> 2003/10/02

On Thu, Oct 02, 2003 at 07:37:25AM +0900, Gavin Sinclair wrote:

[#83404] Re: mixing in class methods — "Gavin Sinclair" <gsinclair@...> 2003/10/02

> On Thu, Oct 02, 2003 at 07:37:25AM +0900, Gavin Sinclair wrote:

[#83416] C or C++? — "Joe Cheng" <code@...>

I'd like to start writing Ruby extensions. Does it make a difference

32 messages 2003/10/02
[#83435] Re: C or C++? — "Aleksei Guzev" <aleksei.guzev@...> 2003/10/02

[#83448] xml in Ruby — paul vudmaska <paul_vudmaska@...> 2003/10/02

The biggest problem i have with Ruby is the sleepness

[#83455] Re: xml in Ruby — Chad Fowler <chad@...> 2003/10/02

On Thu, 2 Oct 2003, paul vudmaska wrote:

[#83464] Re: xml in Ruby or no xml it's just a question — paul vudmaska <paul_vudmaska@...> 2003/10/02

>>--------

[#83470] Re: xml in Ruby — paul vudmaska <paul_vudmaska@...>

>>>

15 messages 2003/10/02

[#83551] xml + ruby — paul vudmaska <paul_vudmaska@...>

>>---------

20 messages 2003/10/03
[#83562] Re: xml + ruby — Austin Ziegler <austin@...> 2003/10/03

On Fri, 3 Oct 2003 16:11:46 +0900, paul vudmaska wrote:

[#83554] hash of hashes — Paul Argentoff <argentoff@...>

Hi all.

18 messages 2003/10/03

[#83675] fox-tool - interactive gui builder for fxruby — henon <user@...>

hi fellows,

15 messages 2003/10/05

[#83730] Re: Enumerable#inject is surprising me... — "Weirich, James" <James.Weirich@...>

> Does it surprise you?

17 messages 2003/10/06
[#83732] Re: Enumerable#inject is surprising me... — nobu.nokada@... 2003/10/07

Hi,

[#83801] Extension Language for a Text Editor — Nikolai Weibull <ruby-talk@...>

OK. So I'm going to write a text editor for my masters' thesis. The

35 messages 2003/10/08
[#83803] Re: Extension Language for a Text Editor — Ryan Pavlik <rpav@...> 2003/10/08

On Thu, 9 Oct 2003 05:06:32 +0900

[#83806] Re: Extension Language for a Text Editor — Nikolai Weibull <ruby-talk@...> 2003/10/08

* Ryan Pavlik <rpav@mephle.com> [Oct, 08 2003 22:30]:

[#83812] Re: Extension Language for a Text Editor — Ryan Pavlik <rpav@...> 2003/10/08

On Thu, 9 Oct 2003 06:09:29 +0900

[#83955] Re: Extension Language for a Text Editor — Nikolai Weibull <ruby-talk@...> 2003/10/09

* Ryan Pavlik <rpav@mephle.com> [Oct, 09 2003 09:10]:

[#84169] General Ruby Programming questions — Simon Kitching <simon@...>

21 messages 2003/10/15
[#84170] Re: General Ruby Programming questions — Florian Gross <flgr@...> 2003/10/15

Simon Kitching wrote:

[#84172] Re: General Ruby Programming questions — Simon Kitching <simon@...> 2003/10/15

Hi Florian..

[#84331] Re: Email Harvesting — Greg Vaughn <gvaughn@...>

Ryan Dlugosz said:

17 messages 2003/10/21
[#84335] Re: Email Harvesting — Hugh Sasse Staff Elec Eng <hgs@...> 2003/10/21

On Wed, 22 Oct 2003, Greg Vaughn wrote:

[#84343] Re: Email Harvesting — Ruben Vandeginste <Ruben.Vandeginste@...> 2003/10/22

On Wed, 22 Oct 2003 08:35:32 +0900, Hugh Sasse Staff Elec Eng

[#84341] Ruby-oriented Linux distro? — Hal Fulton <hal9000@...>

There's been some talk of something like this in the past.

15 messages 2003/10/22
[#84348] Re: Ruby-oriented Linux distro? — Gavin Sinclair <gsinclair@...> 2003/10/22

On Wednesday, October 22, 2003, 6:01:16 PM, Hal wrote:

[#84351] Re: Ruby-oriented Linux distro? — Andrew Walrond <andrew@...> 2003/10/22

On Wednesday 22 Oct 2003 11:02 am, Gavin Sinclair wrote:

[#84420] Struggling with variable arguments to block — "Gavin Sinclair" <gsinclair@...>

Hi -talk,

18 messages 2003/10/24
[#84428] Re: Struggling with variable arguments to block — matz@... (Yukihiro Matsumoto) 2003/10/24

Hi,

[#84604] ruby-dev summary 21637-21729 — Takaaki Tateishi <ttate@...>

Hello,

21 messages 2003/10/30
[#84787] Re: ruby-dev summary 21637-21729 — Paul Brannan <pbrannan@...> 2003/11/06

On Fri, Oct 31, 2003 at 07:01:28AM +0900, Takaaki Tateishi wrote:

[#84789] Re: ruby-dev summary 21637-21729 — matz@... (Yukihiro Matsumoto) 2003/11/06

Hi,

[#84792] Re: ruby-dev summary 21637-21729 — Paul Brannan <pbrannan@...> 2003/11/06

On Thu, Nov 06, 2003 at 11:17:59PM +0900, Yukihiro Matsumoto wrote:

[#84794] Re: ruby-dev summary 21637-21729 — matz@... (Yukihiro Matsumoto) 2003/11/06

Hi,

Re: backquotes, system, shell and ruby

From: "Sean O'Dell" <sean@...>
Date: 2003-10-03 04:28:12 UTC
List: ruby-talk #83542
John Carter wrote:
> Somebody suggested I use zsh instead of bash for my commandline, so I
> looked at it, looked at the syntax for tweaking the profile files, and
> said...
> "Yuck! Another badly designed syntax! Why can't I just use Ruby?"
> 
> And that got me thinking.
> 
> Consider backquotes.
> 
> a = `wc *.c`
> 
> What did that do? Same as open("|wc *.c").
> 
> It ran bash!
> 
> Yuck!
> 
> system( "tar -xvzf foo.tgz foo")
> 
> What did that do? It ran shell!
> 
> Why? Why does a scripting language like Ruby keep invoking an old and bad
> scripting language call shell?

A script language, if it wants to be portable, doesn't "blend" itself 
with unix shell programs.  Ruby has pipes, sockets and other perfectly 
normal programatic ways to communicate between applications.

> Because...
> 
>  a) Ruby doesn't have a good syntax for invoking and dealing with
>     processes and pipes between processes.

It has the IO::pipe method which is pretty standard.  You create a pair 
of pipes, then fork and exec whatever program you want to communicate with.

>  b) Ruby doesn't have a built in understanding of ENV['PATH']

Well, PATH isn't really for programming languages; it's a shell/os 
paradigm.  Programs *can* make use of it, if they choose to, but I don't 
see that as being a languages' responsibility.  It's there in the ENV 
hash; use it if you need it.

Anyway, it would be pretty simple to implement, and I wouldn't be 
surprised if there isn't support for finding programs with it buried 
somewhere in one of the libraries distributed with it.

>  c) Ruby doesn't have such a simple syntax for globbing (beyond
>     Dir['*.c'])
> 
>     Consider the "rename" facility that comes with perl these days.
>        For example, to rename all files matching "*.bak" to strip the exten-
>        sion, you might say
> 
>                rename 's/\.bak$//' *.bak
> 
>        To translate uppercase names to lower, you'd use
> 
>                rename 'y/A-Z/a-z/' *
> 
>    Ooh! Looky! Nice! Wouldn't it be nice to have the power of ruby
>    intertwingled with the commandline.

I would write:

	Dir["*.bak"].each{|f| File::rename(f, f.gsub(/\.bak$/, "")) }

and:

	Dir["*"].each{|f| File::rename(f, f.gsub(/[a-z]/){|s| s.upcase}) }

Wordy, but it should work just fine.

Anyway, Ruby isn't a shell, it's a programming language.

> Ruby does have Shell.rb, which takes us halfway there. (If it had
> decent docs...)
> 
> How hard would it be to extend the backtick syntax to be a pure ruby
> thing. ie. So proc_exec doesn't invoke bash, but invokes Shell.rb?
> 
> Hmm. Could we even do this entirely in UserLand? ie. Couldn't we
> override proc_exec and replace it with ruby code that parses the
> string, handles the redirects, variable interpolation quoting and
> forks, then just directly execs the program without ever touching sh?

I personally don't think it's Ruby's job to be more like a shell. 
Shells do that very well already.  Besides, no matter how much you 
modified Ruby to make it more shell-like, you are always going to find 
things it won't do as well as a shell could, so you will drop out and 
ask the shell to do it.

Using a programming language, as opposed to a shell, means that some 
things are easier to do, and some things are harder.  But I don't think 
changing Ruby to make a specific group of tasks easier, when shells 
already do those tasks very well, is the answer.

	Sean O'Dell


In This Thread