[#68392] J->E translation of Matz's interview on Slashdot Japan — OTA Takashi <t00156to+news@...>
Hi.
On Tue, 1 Apr 2003, OTA Takashi wrote:
OTA Takashi <t00156to+news@sfc.keio.ac.jp> writes:
[#68410] SIGSEGV and crash in $std***.print — Rudolf Polzer <abuse@...>
The following program creates a segfault or interpreter crash extremly
[#68412] JRuby still alive? — "Volkmann, Mark" <Mark.Volkmann@...>
Is development of JRuby still active? Looking at
[#68414] Re: OO vs. procedural programming — "Robert Klemme" <bob.news@...>
[#68415] eval'ing a config file — Ian Macdonald <ian@...>
Hi,
Well I *am* new to Ruby, been playing around for about three weeks now
On Fri, Apr 04, 2003 at 08:25:25AM +0900, Damphyr wrote:
Brian Candler wrote:
On Sat, Apr 05, 2003 at 08:36:12PM +0900, Damphyr wrote:
Brian Candler wrote:
On Sat, Apr 05, 2003 at 11:09:50PM +0900, Damphyr wrote:
[#68417] Getting readline support on solaris — Jim Freeze <jim@...>
Hi:
[#68421] sharing objects between tests (revisited?) — Paul Brannan <pbrannan@...>
I don't know if I've asked this on this list before or only on irc (I
In article <20030401183531.GK24880@atdesk.com>,
On Wed, Apr 02, 2003 at 04:27:46AM +0900, Phil Tomson wrote:
[#68436] April Fools. — Daniel Carrera <dcarrera@...>
Hey guys and gals,
----- Original Message -----
[#68449] Newbie question:read file speed — "Greg Brondo" <greg@...>
Why is ruby (on windows) so much slower at reading lines in a file (as
Here they are:
On Thu, Apr 03, 2003 at 12:51:28AM +0900, Greg Brondo wrote:
On Friday, April 4, 2003, 12:10:00 AM, Dan wrote:
[#68520] Madeleine 0.2 — Anders Bengtsson <ndrsbngtssn@...>
http://sourceforge.net/project/showfiles.php?group_id=74624
[#68527] Any Hardware/EDA engineers out there? — ptkwt@...1.aracnet.com (Phil Tomson)
[#68538] Tricky install question — Mike Wyer <mike@...>
Hi,
[#68551] cgi serving xml from Apache problem — "Chris Morris" <chrismo@...>
(This seems like more an Apache question than a Ruby question, but ...)
[#68564] FXRuby -- Table with FXComboBox items — Yura Kloubakov <yura@...>
Hi,
[#68573] "benchmark.rb:435: warning: obsolete method" — Brian Candler <B.Candler@...>
Just been playing with 1.8 preview 2, would like to point out that the
[#68584] read/write slow, and TCPSocket and sys{read,write} — Ryan Pavlik <rpav@...>
OK, so I'm throwing things back and forth over the network. Marshalled
On Fri, 4 Apr 2003 05:48:53 +0900
On Fri, Apr 04, 2003 at 06:06:15AM +0900, Ryan Pavlik wrote:
[#68587] Building Ruby on HP-UX B.11.22 — Daniel Berger <djberge@...>
Hi all,
[#68605] keeping track of non-exported global variables — "Simon Strandgaard" <0bz63fz3m1qt3001@...>
problem:
[#68612] Suggestion for Ruby Weekly News — leikind@... (Yuri Leikind)
Hello all,
Yuri Leikind (leikind@mova.org) wrote:
[#68613] Debugger — Seth Kurtzberg <seth@...>
Hello list,
[#68623] To inherit or to include? That is the question. — Jim Freeze <jim@...>
Hi
[#68624] Relocatable install patch — Mike Wyer <mike@...>
Hi,
[#68657] reading from $stdout ??? — "meinrad<dot>recheis" <"meinrad<dot>recheis"@...>
hi rubyists,
[#68672] Strangeness in Find.find — Brian Candler <B.Candler@...>
I was just looking at lib/ruby/1.8/find.rb and I am stumped by the marked
[#68707] Call for standardised package installation procedure — google@... (Tom Payne)
I'm helping maintain Ruby and Ruby packages in Gentoo Linux.
> It would make my job a lot easier if just one were chosen, and perhaps
> > It would make my job a lot easier if just one were chosen, and perhaps
On Mon, Apr 07, 2003 at 03:52:28AM +0900, John Johnson wrote:
----- Original Message -----
> From: Hal E. Fulton [mailto:hal9000@hypermetrics.com]
In article <NGEDJNFKAGDNDOIPFPBDIEDIDNAA.james_b@neurogami.com>,
On Tue, 8 Apr 2003 james_b@neurogami.com wrote:
John Johnson <jj5412@earthlink.net> wrote in message news:<1049655145.1847.10.camel@hppav.home.net>...
On Mon, 7 Apr 2003 16:47:20 +0900, Tom Payne wrote:
On Tue, Apr 08, 2003 at 02:34:26AM +0900, Austin Ziegler wrote:
On Tuesday, April 8, 2003, 3:42:49 AM, Mauricio wrote:
On Tue, Apr 08, 2003 at 10:11:28PM +0900, Gavin Sinclair wrote:
On Tue, Apr 08, 2003 at 10:11:28PM +0900, Gavin Sinclair wrote:
gsinclair@soyabean.com.au wrote in comp.lang.ruby:
"James Britt" <james@jamesbritt.com> wrote in message news:<NGEDJNFKAGDNDOIPFPBDGECLDNAA.james@jamesbritt.com>...
[#68726] Mutexes end critical sections? — Tom Felker <tcfelker@...>
I was looking at threads.rb for Ruby 1.6, and I noticed that Mutex,
[#68760] ruby-dev summary 19944 - 19957 — Kazuo Saito <ksaito@...>
Hello,
[#68764] a question about regexp — "Ben Thomas" <ben.thomas@...>
Hi,
[#68774] exit status from popen3 — Daniel Bretoi <lists@...>
Hi,
[#68803] Having trouble getting iconv-0.5 working on OS X — Sam Roberts <sroberts@...>
I do a make, install, and then:
Hi,
I think so, too, but I've no idea how. The only thing I can think of is
The error turned out to be deceptively simple. extconf.rb fails to find
Hi,
Quoteing nobu.nokada@softhome.net, on Sun, Apr 13, 2003 at 02:15:54PM +0900:
Hi,
Quoteing nobu.nokada@softhome.net, on Sun, Apr 13, 2003 at 07:44:34PM +0900:
[#68811] Array Sutraction — Jim Freeze <jim@...>
Ok, this has been discussed at length previously,
>
----- Original Message -----
On Tuesday, 8 April 2003 at 22:59:50 +0900, Michael Campbell wrote:
On Tue, 8 Apr 2003 23:33:17 +0900, Jim Freeze wrote:
----- Original Message -----
[#68816] sending a file via http — "Andrew" <nospam123@...>
Hello,
Yes, this is using CGI. Your code seems to do almost what I want, but it
[#68843] Ruby for graphics — "Your Name Here" <jim@...>
I just learned of Ruby, and was wondering if its a good lang for
--- Your Name Here <jim@fivek.com> wrote:
[#68854] Problem with timeout for DBI on Solaris — Daniel Berger <djberge@...>
Hi all,
[#68866] Style Question — Travis Whitton <whitton@...>
I've looked in the RubyStyleGuide on the Wiki, and I don't see this addressed.
[#68878] 1.8 parse error? — ahoward <ahoward@...>
[#68881] Can someone explain what's happening here? (String#gsub question) — Michael Campbell <michael_s_campbell@...>
I read the caveat in the pickaxe about when the replacement is a
[#68890] instance_variable_set question — "Chris Pine" <nemo@...>
Hello,
----- Original Message -----
[#68901] Versioning prototype for discussion — ptkwt@...1.aracnet.com (Phil Tomson)
On Wed, Apr 09, 2003 at 06:36:25AM +0900, Phil Tomson wrote:
[#68908] The "!" and "?" characters. — Daniel Carrera <dcarrera@...>
One of the things I like about Ruby is that it can use ! and ? in method
----- Original Message -----
By the way why not allow to define new operators, like in prolog and
Hi,
[#68943] unknown node type 0 — Francois GORET <fg@...>
Hello,
Hi,
On Wed, 9 Apr 2003, Yukihiro Matsumoto wrote:
Hi,
[#68967] Simple Question — Dominik Werder <dwerder@...>
Hi there,
[#68976] Investment Partnership. — Nzanga Kuzulu Mobutu <nzanga_1@...>
Nzanga Kuzulu Mobutu
[#68996] ANN: ri v1.8 — Dave Thomas <dave@...>
I'm releasing a very preliminary version of 'ri' for Ruby 1.8. This
`ri' was based on the pickaxe class reference, right? Any chance of seeing
On Wed 09 Apr 2003 at 23:52:47 +0900, Dave Thomas wrote:
[#69004] Proc Question — Travis Whitton <whitton@...>
As I was coding this morning, a question occured to me. Why must proc objects
[#69012] I quote: "Maybe IRB bug!!" — "Chris Pine" <nemo@...>
Hmmm...
[#69025] tutorial on embedding ruby (review) — "Simon Strandgaard" <0bz63fz3m1qt3001@...>
What do you think about it ?
[#69054] PRIVATE AND CONFIDENTIAL — "Mr. John Eze" <mr_musa3@...>
As an aside not only would the origonal spam be removed by your rules,
On Thu, 10 Apr 2003, Peter Hickman wrote:
[#69096] Need IO Optimization help — Jim Freeze <jim@...>
Hello:
In article <20030411115918.A35958@linnet.org>,
The following is from
Mark Wilson wrote:
On Sat, 12 Apr 2003 13:40:07 +0900
On Apr 12, Ryan Pavlik wrote:
On Sun, 13 Apr 2003 00:49:00 +0900
Just a note on my questions about type (also known as class, in Ruby).
Jim Freeze wrote:
On Friday, 11 April 2003 at 17:47:39 +0900, Robert Klemme wrote:
On Fri, Apr 11, 2003 at 06:47:27PM +0900, Jim Freeze wrote:
In my experience, the fastest way to access files (by far) is mmap.
On Thursday, 17 April 2003 at 19:29:16 +0900, David King Landrith wrote:
On Thursday, April 17, 2003, at 06:45 AM, Jim Freeze wrote:
On Thursday, 17 April 2003 at 22:11:55 +0900, David King Landrith wrote:
> > >> In my experience, the fastest way to access files (by far) is
On Friday, 18 April 2003 at 3:19:08 +0900, Michael Campbell wrote:
>>>>> "J" == Jim Freeze <jim@freeze.org> writes:
On Thu, Apr 17, 2003 at 10:34:53PM +0900, ts wrote:
On Thursday, 17 April 2003 at 22:46:04 +0900, Brian Candler wrote:
[#69106] changing behavior of literal {:k => :v} — ahoward <ahoward@...>
[#69132] FAQ for comp.lang.ruby — hal9000@...
RUBY NEWSGROUP FAQ -- Welcome to comp.lang.ruby! (Revised 2003-1-7)
[#69145] "illegal radix 1" — Daniel Carrera <dcarrera@...>
Hi,
> |>> "2".to_i *1.1
[#69151] plotting 2D math functions — ptkwt@...1.aracnet.com (Phil Tomson)
I know there's a package on the RAA for plotting functions with
[#69161] rb_io_getline question — Jim Freeze <jim@...>
Hi:
>>>>> "J" == Jim Freeze <jim@freeze.org> writes:
[#69179] Two questions — "Steve Adams" <adamss@...>
What restrictions does the Ruby license place on the construction and sale
[#69181] rb_str_chomp or rb_str_strip — Jim Freeze <jim@...>
How do I access the chomp(!) or strip(!) functions in C?
>>>>> "J" == Jim Freeze <jim@freeze.org> writes:
On Saturday, 12 April 2003 at 1:00:44 +0900, ts wrote:
[#69194] splat question — "Chris Pine" <nemo@...>
(This question assumes that the unary `*' (used in arrays and such) is
[#69214] class documentation — "Bermejo, Rodrigo" <rodrigo.bermejo@...>
Hi all;
On Sat, 12 Apr 2003 06:00:30 +0900, Bermejo, Rodrigo wrote:
Ok, I've been looking at Marshal, PStore, Madelaine and mnemonic. None of
[#69271] Controlling an interactive program from Ruby — Daniel Carrera <dcarrera@...>
Hi,
On Sun, 13 Apr 2003 11:26:20 +0900, Daniel Carrera wrote:
Simon Strandgaard wrote:
On Sun, Apr 13, 2003 at 12:16:54PM +0900, Joel VanderWerf wrote:
On Sun, Apr 13, 2003 at 05:06:42PM +0900, Mauricio Fern?ndez wrote:
[#69280] ruby_script() — "Simon Strandgaard" <0bz63fz3m1qt3001@...>
I am wondering what exactly ruby_script() is doing ?
[#69282] using ruby reflection to generate code — Doug Beaver <doug@...>
hello,
In article <20030413004111.A80880@beaver.net>,
[#69301] problems embedding ruby in win32 — "Gaffer" <gaffer@...>
hello there,
[#69323] ANN: RFC 2047 decoding library (MIME format for non-ascii in mail headers) — Sam Roberts <sroberts@...>
There was a few posts about this, so perhaps somebody will find it
Saluton!
Thanks for the feedback. I'll run your example (thanks) through iconv,
Saluton!
(Nobu, this question relates to using iconv to convert from iso-2022-jp
Hi,
[#69338] YAPLL — <james_b@...>
Yet another programming language list.
On Mon, Apr 14, 2003 at 03:24:47PM +0900, james_b@neurogami.com wrote:
On Mon, Apr 14, 2003 at 05:17:59PM +0900, Mauricio Fern疣dez wrote:
[#69339] File::expand_path amok — "Ariff Abdullah" <skywizard@...>
$ pwd
[#69342] ANN: FreeRIDE 0.5.0 Release Candidate 2 — "Curt Hibbs" <curt@...>
FreeRIDE 0.5.0 Release Candidate 2 is available for download. Go to
[#69357] A class, that knows about it's instances + Sets — KONTRA Gergely <kgergely@...>
Hi!
I ran into a similar problem using Madeleine. In Madeleine, you need to
[#69366] How do I call a regex from C? — Jim Freeze <jim@...>
Hi:
>>>>> "J" == Jim Freeze <jim@freeze.org> writes:
On Monday, 14 April 2003 at 23:25:03 +0900, ts wrote:
>>>>> "J" == Jim Freeze <jim@freeze.org> writes:
On Tuesday, 15 April 2003 at 0:06:08 +0900, ts wrote:
>>>>> "J" == Jim Freeze <jim@freeze.org> writes:
[#69372] , ruby 1.6.8 (2002-12-24) [i586-mswin32] — student_vienna@... (daniel)
hello,
[#69413] rb_class_new_instance behaves strange — "Simon Strandgaard" <0bz63fz3m1qt3001@...>
My code is behaving different, when im doing this change:
On Wed, 16 Apr 2003 01:32:33 +0900, nobu.nokad wrote:
[Nobu said:]
[#69424] Urgent Assistance — "Victor Aloma" <victorloma@...>
Could someone point me to an open-source SPAM filter that I can install on
Hello!
On Wed, Apr 16, 2003 at 07:00:20AM +0900, Pablo Lorenzzoni wrote:
[#69439] ANN: Debian packages of FreeRIDE, FOX, FXRuby, Ripper, FXScintilla, etc — Mauricio Fern疣dez <batsman.geo@...>
> I have tested that it is possible to rebuild all the packages with
[#69449] Re: [OT] spam filter Was: Re: Urgent Assistance — <wtanksleyjr@...>
From: "Shannon Fang" <xrfang@hotmail.com>
On Wed, Apr 16, 2003 at 03:43:11AM +0900, wtanksleyjr@cox.net wrote:
[#69470] regular expressions — "Chris Pine" <nemo@...>
When I first learned regular expressions, they were no problem. It was in a
----- Original Message -----
Hi --
[#69494] Libxml SAX parser? — han.holl@... (Han Holl)
Hello,
[#69518] Roundoff problem with Float and Marshal — cilibrar@... (Rudi Cilibrasi)
The following small test program:
nobu.nokada@softhome.net wrote in message news:<200304161751.h3GHpIHQ017185@sharui.nakada.kanuma.tochigi.jp>...
[#69527] Debugger not working in 1.8.0 snapshot — Jeff Putsch <putsch@...>
Howdy,
[#69531] example — student_vienna@... (daniel)
hello,
[#69536] Reg. Expressios with "\n" — Daniel Carrera <dcarrera@...>
Hello,
----- Original Message -----
[#69568] How to test for text file — "Peter B. Ensch" <pNOeterSPAM4MEbe@...>
In perl, -T <file> returns true if <file> is a text file and
[#69585] extension - redirect a block — student_vienna@... (daniel)
hello,
[#69595] ANN: ri 1.8b — Dave Thomas <dave@...>
I've updated ri:
Dave Thomas wrote:
Dave Thomas wrote:
[#69611] Cryptic -w warning: ambiguous first argument; make sure ... — Johan Holmberg <holmberg@...>
[#69639] FreeRIDE 0.5.0 - problem opening files — Markus Jais <info@...>
Hello
[#69645] avoiding the module name — "Simon Strandgaard" <0bz63fz3m1qt3001@...>
[#69672] Fw: Possible bug? — "Chad Fowler" <chadfowler@...>
I'm having some trouble sending to ruby-core, so I'll send this here. Sorry
[#69680] Warning: redefine instance — jbshaldane@... (haldane)
Does anyone know why I am getting this warning?
[#69700] Biased weighted random? — "Hal E. Fulton" <hal9000@...>
Hi, all...
----- Original Message -----
----- Original Message -----
----- Original Message -----
----- Original Message -----
[#69712] Multi-dimensional arrays — marsberger@... (Andi Scharfstein)
Hi,
[#69723] Bug in Rational? — "Chris Pine" <nemo@...>
This *can't* be right:
[#69762] Multi-Lingual Ruby — Jim Weirich <jweirich@...>
I was following a Java VS Perl discussion on a web board that I read.
DOH!
On Sun, 20 Apr 2003 13:43:59 +0900
> Actually, you shouldn't be, since that seems to (somehow) be the
[#69792] Matrix bug — oinkoink+unet@... (Bret Jolly)
An old bug from ruby 1.6 is still unfixed in the ruby 1.8 preview.
[#69806] ASCII class inheritance tree generator — Simon Vandemoortele <deliriousNOSPAM@...>
I thought I might share this little piece of code that generates a
[#69807] Re: ASCII class inheritance tree generator — "Pe, Botp" <botp@...>
Simon Vandemoortele [mailto:deliriousNOSPAM@atchoo.be] wrote:
[#69818] module_functions are private? — Paul Brannan <pbrannan@...>
I have a piece of code that does something like this:
>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:
On Mon, Apr 21, 2003 at 11:23:54PM +0900, ts wrote:
>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:
[#69825] accessing top-level 'self' — ahoward <ahoward@...>
[#69830] Ruby in a university course — "Chad Fowler" <chadfowler@...>
Maybe this has already been covered here, but I found it interesting =
[#69834] What's the difference between IO and File — Jim Freeze <jim@...>
Hi
[#69866] two-way pipe — vic ismakaev <viclists@...>
Hi!
[#69908] Select() — "Kuros" <kuros@...>
Hi Everyone,
[#69917] DBI/OCI8 & binary data — Ollivier Robert <roberto@...>
Env.: ruby 1.6.8, ruby-dbi 0.18, ruby-oci8 0.1.2.
[#69922] Module inclusion at runtime... — Hadmut Danisch <spamblock@...>
Hi,
[#69931] Ruby.shop — "Hal E. Fulton" <hal9000@...>
Hello, all.
----- Original Message -----
----- Original Message -----
----- Original Message -----
----- Original Message -----
----- Original Message -----
----- Original Message -----
----- Original Message -----
[#69956] grep and regular expressions in ruby — "Krishna Dole" <kpd@...>
I'm quite taken with ruby, but recently I ran into trouble using grep. I
On Thu, Apr 24, 2003 at 08:17:37AM +0900, Bermejo, Rodrigo wrote:
[#69957] two oddities in ruby 1.8.0p2 — davekam@... (Dave)
OK, recently a cool feature has been added to ruby to start assigning
[#69969] Subject: Re: [ANN] Ruby.shop — Jim Weirich <jweirich@...>
On Wed, 2003-04-23 at 18:16, Hal E. Fulton wrote:
[#69977] parsing large file into matrix — "Qubert" <qubert@...>
I work on a lot of flat files containing data with many columns
[#69998] Ruby mode for Emacs... — Stephan K舂per <Stephan.Kaemper@...>
Hi all,
[#70000] Using objects persistence — Pablo Lorenzzoni <spectra@...>
Hello ALL!
[#70015] How to call an object instance's method? — Rene Tschirley <pooh@...>
Dear Ruby Experts,
Robert Klemme wrote:
Hi --
On Fri, Apr 25, 2003 at 01:07:33AM +0900, dblack@superlink.net wrote:
----- Original Message -----
> Yuck!! This is what's wrong with significant whitespace. We are
On Fri, Apr 25, 2003 at 09:54:16PM +0900, Michael Campbell wrote:
[#70017] MathN — Dave Thomas <dave@...>
I'm trying to get to grips with the 'mathn' library. I can see what it
[#70025] Design By Contract. — "Ken Hilton" <kenosis@...>
Several months ago, I made a posting regarding a possible enhancement to
[#70034] block.call vs. yield — "Orion Hunter" <orion2480@...>
I noticed that the use of block/yield differs slightly when a "break" is
Hi,
Hi,
Hi --
Hi,
> In message "Re: block.call vs. yield"
Hi --
Hi,
----- Original Message -----
Hi --
Hi,
On Sunday, April 27, 2003, 1:13:40 AM, dblack wrote:
On Mon, Apr 28, 2003 at 06:06:36PM +0900, Gavin Sinclair wrote:
On Monday, April 28, 2003, 7:17:24 PM, Brian wrote:
[#70039] Accessing Ruby class from C extention — ptkwt@...1.aracnet.com (Phil Tomson)
I know it's possible to write Ruby in C but is it possible to instantiate
[#70042] asynchronous ruby — student_vienna@... (daniel)
hello,
[#70064] Hashes and Enumerable#each_with_index — Ryan Pavlik <rpav@...>
OK, looking at the archives I know this was discussed a few years ago,
Hi,
On Fri, 25 Apr 2003 08:10:04 +0900
[#70144] Parsing C++ with Ruby — Simon Vandemoortele <deliriousNOSPAM@...>
[#70167] yield self — ahoward <ahoward@...>
[#70177] How to get more than 8 colors ? — Simon Vandemoortele <deliriousNOSPAM@...>
Here is a copy of the question I entered on
[#70204] can you guess — ahoward <ahoward@...>
[#70211] How do I change directories? — Daniel Carrera <dcarrera@...>
Hi,
[#70215] XML Parsing the Ruby way. — Aredridel <aredridel@...>
I've been looking at REXML, and I really like the architecture: A very
[#70217] Ruby misfeature? => CONTEST: solve the following problem — Mauricio Fern疣dez <batsman.geo@...>
[#70224] File reading and line continuation with '\' — Jim Freeze <jim@...>
Hi:
This should do it:
[#70243] Regexp and $ — Brian Candler <B.Candler@...>
I seem to remember some discussion about regexps recently, including Perl
[#70265] Generating a DLL file? — "Rich" <rich@...>
Let's start with:=20
I don't know C - or C++... and I'd rather not learn.
--- Rich <rich@lithinos.com> wrote:
----- Original Message -----
> > > I don't know C - or C++... and I'd rather not learn.
[#70268] c++/ruby debugging advices — "Simon Strandgaard" <0bz63fz3m1qt3001@...>
Im embedding ruby into c++ and im having a segfault problem which
[#70289] ANN: FreeRIDE 0.5.0 Final Release — "Curt Hibbs" <curt@...>
The final release of FreeRIDE version 0.5.0 is available for download! For
[#70324] File#split bug? — Jim Freeze <jim@...>
Is this a bug in File#split?
[#70337] Manipulate IE via Ruby? ... — christopher.j.meisenzahl@...
I want to tinker with the concept of Windows Automation as described in chapter
[#70354] Re: ANN: FreeRIDE 0.5.0 Final Release — "Curt Hibbs" <curt@...>
Steve Tuckner wrote:
Curt Hibbs wrote:
[#70358] locking in CGI script — kwatch@... (kwatch)
Hi,
[#70371] Re: Manipulate IE via Ruby? Redux ... — christopher.j.meisenzahl@...
Thanks very much for the MSDN link whoever sent it! I accidentally deleted your
[#70376] Test order in Test::Unit — Takashi & Kayoko Sano <tksano@...3.kcn.ne.jp>
Hi all,
[#70399] Ruby regexp backreferences — Austin Ziegler <austin@...>
I'm doing something that required RLE, and the code that I
[#70405] ugly style variables — saggmannen@... (saggmannen)
I'm new to ruby, and thus far I mostly like what I've seen. But these
[#70422] Pass-by reference VS encapsulation ? — Simon Vandemoortele <deliriousREMOVEUPPERCASETEXTTOREPLY@...>
On Wed, 30 Apr 2003 at 18:07 GMT, Dave Thomas wrote:
Re: Newbie proc question
In article <8fd3ee12.0304161737.32de03da@posting.google.com>,
James Toomey <jamesvtoomey@yahoo.com> wrote:
>Can anyone help reduce my confusion? I think I understand the "how" of
>proc blocks, but I still don't get the "why," particularly with a
>dynamically passed block of code, like in the following sample:
>
>def dummyMethod(&dynamicBlock)
> dynamicBlock.call
>end
>
>dummyMethod {
> puts 'This is line 1 of custom block code'
> puts 'This is line 2 of custom block code'
>}
>
>From what I've read, the proc block feature isn't found in many
>languages, and makes Ruby (and others like Lisp) much more flexible
>and powerful. However, I don't quite grasp why. Is the benefit that
>you don't need to modify "dummyMethod" at all, but rather just modify
>the code within the block?
No, that wouldn't be much benefit.
>And if this is the case, why is that
>better? After all, if you have to make code changes, you still have to
>change it somewhere, regardless of whether you're changing it in
>"dummyMethod" or in the code block.
Right.
>I don't see the benefit of passing
>blocks of code around instead of just including that code in the
>method you're calling.
>I'm coming at this from a Visual Basic background, so I'm sure I'm a
>bit like a Neanderthal being shown a power drill and wondering why
>it's any better than my rock tool.
;-)
>I get the feeling that proc blocks
>can do great things, but I just don't see why.
Yes, you can do great things with them. Maybe a real world example is in
order.
I've created a hardware simulator using Ruby (RHDL) and there is a step
method that steps to the next simulation 'time' (think of it kind of like
using 'step' in a debugger to step to the next line in a program).
At first my step method didn't take any arguments, but then I got the idea
that a user might want to display some information or perhaps change some
input(s) at each time step, so I made it so that step could take a block
and then remember that block until another block is given (saves a lot
typing for the user).
Without going into a lot of details, here's how it works in practice:
#given some setup of signals: clk, rst, output:
step { clk = clk.inv #invert clk signal
#display signal values:
puts "clk=#{clk}, rst=#{rst}, output=#{output}"
}
So I guess the main point here is that the user of my API can add their
own code to specify what should be done from one step to another. The
user could put anything between the '{}'s. It essentially means that my
program becomes more flexible because I've allowed users to pass in their
own code.
Of course, this isn't the only advantage of blocks. Probably the biggest
use is in iterators (like Array#each) - but the advantage is similar: it
allows the user of the iterator to specify some code that gets run at each
step of the iteration.
So to summerize: A big reason to allow a method to take a block is to
allow users of your code to pass in code. This makes your code more
flexible (usable in a greater number of situations) because when you allow
blocks you're essentially saying that you are not trying to foresee every
possible way that your code should be used, so you're allowing the user
of your code to insert code of their own to do what they need to get done.
Make sense?
This probably isn't the only rationale for using blocks. I'm sure others
will provide other reasons.
The other thing to add here is that Ruby's block mechanism is quite
elegant and unique - it essentially allows you to create domain specific
languages that look syntactically very natural. (RHDL is an example of
this)
Phil