4501-4833 subjects 4903-5272

Getting started
4678 [Steve.Merric] Following the "getting started" from the Ruby User Guide, I typed

ruby 1.6.0 preview
4693 [matz@ze ab t] Here's the preview release of 1.6.0.  This is almost identical to
4698 [Dave@Th ma e] I just wanted to say a big "thank you" for all the hard work you're

Getting started
4695 [Steve.Merric] I have downloaded Ruby for use on my Windows NT4 SP4 PC. I have downloaded
4696 [hipster@xs a] IIRC, you need to set TMP or TMPDIR or TEMPDIR (can't remember which) to
4697 [Steve.Merric] to
4700 [schneik@us i] [I originally posted this to comp.lang.ruby, but it apparently never made
+ 4722 [Steve.Merric] Then could someone please identify the latest Windows NT version for me,
+ 4723 [decoux@mo lo] You can look at RAA in the category Ports
  + 4724 [schneik@us i] # S> Then could someone please identify the latest Windows NT version for
  + 4730 [Steve.Merric] for me,
  | 4733 [neumann@s- i] You can also look at: http://dev.rubycentral.com/links/index.html
  + 4731 [decoux@mo lo] Follow this URL

Double parenthesis
4699 [ks@tp .r hr ] Why is the first line ok, but the second line is not?
+ 4714 [decoux@mo lo] pigeon% ruby -e 'p ( [1].each() do puts "hello" end )'
| 4717 [yashi@ya hi ] or
+ 4719 [matz@ze ab t] 1) the latter works on ruby 1.6.0.
  4721 [yashi@ya hi ] uh... it doesn't
  4725 [matz@ze ab t] Well,.. NOW it does. ;-)
  4726 [yashi@ya hi ] indeed. :)

Two observations
4702 [ms@ia ta e. ] (1) A top-level method gets appended to the Object class and made private,
4703 [Dave@th ma e] It still raises the exception, it's just that the hierarchy changed
4706 [ms@ia ta e. ] Ok, "rescue Exception" gives the behavior I was looking for from "rescue".  That's easy
4708 [Dave@th ma e] The latest eval.rb is already fixed. It has
4709 [ms@ia ta e. ] My eval.rb was derived from the version in matz's tutorial ... I'd better look at the
4710 [Dave@th ma e] Well... it's in the book ;-)
4713 [decoux@mo lo] Perhaps this case ?
+ 4715 [ms@ia ta e. ] Curiouser and curiouser. why does "bar" by itself work here? - it must not be
+ 4716 [decoux@mo lo] because it's a method of Object
  + 4728 [ms@ia ta e. ] Then it's an access control issue, not an inheritance issue: "private" doesn't mean
  + 4729 [decoux@mo lo] Have you looked at http://dev.rubycentral.com/faq/rubyfaq-5.html#ss5.7 ?
    4732 [ms@ia ta e. ] Gasp! there it is.

new, initialize, etc.
4705 [hal9000@hy e] I'm seeking an overview of this stuff.
+ 4707 [Dave@th ma e] There's something magical that happens between 'new' and
+ 4711 [matz@ze ab t] As Dave explained in [ruby-dev:4707], the instance creation is done in
  4712 [hfulton@au t] Thank you both for these answers.

NG posting test -- please ignore.
4718 [schneik@au t] This space intentionally left non-blank.

ruby 1.6.0 preview
4720 [schneik@us i] cc -g -I. -I. -I/usr/local/include -c util.c

Possible regex bug?
4734 [hal9000@hy e] OK, I'm trying to match an optional comma followed by
4736 [Dave@th ma e] Always be careful with patterns containing '*'. For example,
+ 4739 [hal9000@hy e] Of course!
+ 4740 [schneiker@ju] I guess I didn't read the docs carefully enough. The reason I didn't mention
  + 4743 [Dave@th ma e] my @a = split(/,? */, "1.2, 3.4, 5.6/");
  + 4747 [decoux@mo lo] There is a difference between perl and ruby.
    + 4748 [Dave@th ma e] This would seem to be a problem with Perl ;-) Try is with a zero
    + 4750 [decoux@mo lo] a scan() is more like a //g in perl
      + 4751 [Dave@th ma e] You're right - I should have had a /g on the Perl example.
      + 4752 [decoux@mo lo] Yes but perl and ruby don't have the same notion of zero-length match
        + 4754 [Dave@th ma e] d'accord. That's true, but kind of orthogonal to the point that Conrad
        | 4844 [schneik@au t] Well, speaking for Conrad, he raised at least 3 points/concerns, so you
        + 4755 [matz@ze ab t] Well, I didn't know that.  But I feel Ruby is consistent.

Re: Ruby tutorials for newbie -- Matz AWL Book question.
4741 [schneiker@ju] ==============================================
4753 [matz@ze ab t] OK, but please mention my co-author Keiju Ishitsuka too.

Ruby bindings to XPCOM (Mozilla's component architecture) for Komodo IDE
4742 [schneiker@ju] Dr. David Ascher, Senior Developer and Mozilla Product Leader, ActiveState

Piping in Ruby?
4744 [steve@de f. ] There's one construct I miss from shell scripts... The ability to pipe the
+ 4745 [steve@de f. ] A clarification... I want to pipe between procedures, not programs.
+ 4746 [Dave@th ma e] Could you give an example of how you'd use this in Ruby?
  + 4757 [steve@de f. ] a = []
  | 4760 [aseltine@cs ] list.scan(pattern).collect{|i| convert(i)}.each{|i| code}
  + 4758 [steve@de f. ] list.each {|i| puts i } | grep "fred"
    4761 [Dave@th ma e] The trick in both of these cases is to keep your data in array format
    + 4810 [schneik@us i] [Resending to ruby-talk ML; the original _newsgroup_ post seems to have
    | 4812 [Dave@th ma e] You can't use the $& form in a string parameter to sub, because the
    + 4838 [schneik@au t] ====================================================

Re: Which distribution (was Windows registry)
4756 [trinexus@on ] I have downloaded two distributions and neither of them have an ext

RUBY NEWSGROUP FAQ -- Welcome to comp.lang.ruby!  (Revised 2000-09-03)
4759 [schneiker@ju] RUBY NEWSGROUP FAQ -- Welcome to comp.lang.ruby!  (Revised 2000-09-03)

4766 [trinexus@on ] ...
+ 4767 [hal9000@hy e] ...
| 4786 [trinexus@on ] ...
+ 4768 [nahi@ke na t] AFAIK, there are two wiki clone for Ruby; Tiki and RWiki.
  4783 [m_seki@mv .b] I can't open the web site. Sorry, I have no plan...
  4785 [nakahiro@sa ] Howdy,
  4787 [trinexus@on ] So is this going to be the official wiki for Ruby?  The WelcomeVisitors page
  4799 [nahi@ke na t] No, AFAIK.  Word 'official' did not make sense to me...
  4800 [matz@ze ab t] I have too little knowledge about Wiki to comment this.
  4801 [nahi@ke na t] Agreed.  For discussion, mail list is a must.
  + 4802 [maki@in c. o] How about `Ruby ML Topics'?
  + 4803 [Dave@th ma e] The classic Wiki at c2.com started of as a place for people to discuss
  | 4807 [trinexus@on ] True enough.  It's user base probably became too broad as did the content.
  + 4829 [matju@ca .o ] I prefer to see it as a glossary or a knowledge base, but I haven't

unix 'time' in Ruby?
4769 [feldt@ce ch ] Is there a way to get the actual processing time of a Ruby
+ 4771 [matz@ze ab t] #! /usr/bin/env ruby
| 4772 [feldt@ce ch ] Oops, sorry for missing this. I thought Time only had funcs for real time.
| 4773 [matz@ze ab t] Time#times is an only exception in Time methods.
| 4779 [Dave@th ma e] I've been thinking about this: should #times migrate across to
| + 4780 [feldt@ce ch ] The first thing I though when needing unix-like time was to go check in
| + 4784 [matz@ze ab t] Hmm, I couldn't think of. Let me add it to the ToDo list.
+ 4794 [andy@to ls e] Time.times returns a Struct object with accessors for utime, stime,

Module vs. Class
4774 [jilanik@ti .] when it is more convenient to use module than classes, seen classes can
4775 [matz@ze ab t] Two purpose; to provide merely a namespace, and to implement mix-in.
4777 [jilanik@ti .] And perhaps to "simulate" the inner classes feature of Java?
4789 [matju@ca .o ] well, not quite. Inner classes are a different kind of beast; an instance
4790 [matz@ze ab t] Yes, but it provides implementation too.

Listing methods in a module
4776 [bombadil@wa ] With $" I can list loaded modules.
4778 [hipster@xs a] ObjectSpace.each_object{ |o|
4788 [matju@ca .o ] what's the advantage over the following?
4791 [hipster@xs a] To be precise: zilch.

Bug in Time.times on NT?
4781 [feldt@ce ch ] There seems to be a bug in the script below when I run it on my machine.
4782 [Dave@th ma e] It seems to have been: the code's been restructured, and the Win32

4792 [zakons@ob ec] Can somebody please explain what a closure is within the context of
+ 4793 [Dave@th ma e] A closure is simply a chunk of code that "remembers" the context that
| 4795 [yashi@ya hi ] Dave has already explained closure nicely, so I'll show a pitfall.
+ 4805 [Steve.Merric] I too would be grateful for such an explanation. "Closure" has become
  + 4811 [schneik@us i] # > Can somebody please explain what a closure is within the context of
  | 4855 [zakons@ob ec] of
  | 4865 [andy@to ls e] Well, in Java at least, the anonymous inner classes are described
  | 4908 [zakons@ob ec] objects in
  + 4841 [c.hintze@gm ] Hmmm ... it something everybody knows but difficult to explain ;-) Let

Ruby Documentation Project(trial)
4796 [rubikitch@ru] The Ruby Documentation Project(trial) makes RD documentations that has been undocumented or has

Caret notation?
4797 [hal9000@hy e] ...
+ 4798 [matz@ze ab t] I don't think I allowed this notation, except vague memory of ancient
+ 4804 [decoux@mo lo] Apparently 1.1, 1.2 accept it
  4806 [matz@ze ab t] Indeed.  Unfortunately, ChangeLog does not contain description about

ruby-talk <-> comp.lang.ruby gateway trouble
4808 [nosuzuki@e- ] The gateway between ML ruby-talk and Newsgroup comp.lang.ruby stop
4861 [schneik@au t] Thanks much for getting this working again.

Some questions
4809 [frido@q- of ] - is there a reason why there isn't a each_index in String?
4813 [matz@ze ab t] Because String is not a indexed container.  You can use
+ 4814 [Dave@th ma e] A recursive constructor: I love it ;-)
+ 4816 [frido@q- of ] aren't Strings just Arrays? I have looked into the functions of the
| + 4818 [matz@ze ab t] No.  Of course, String and Array share many method as sequences.  But
| | 4822 [frido@q- of ] Yes, thanks. I was not aware that Strings beeing "two-dimensional". I
| + 4825 [matju@ca .o ] Linked lists have one speed advantage, it's that you can splice them
+ 4817 [Dave@th ma e] I'm nervous about jumping in here, Matz, but they do look like indexed
  4819 [matz@ze ab t] I think [ruby-talk:4818] answers this question too.
  4820 [Dave@th ma e] and in 4818...
  4821 [matz@ze ab t] Yes, each_with_index has same problem.  But each_index is worse, since

4815 [hal9000@hy e] ...

representing binary state in plain Ruby object
4823 [yashi@ya hi ] I'm writing a new class in the C level
4824 [aleksi.nieme] Well, if you want bit-operations they are all there already. Just look
4834 [yashi@ya hi ] well the problem is it's slower than just referencing an instance
4836 [kjana@os xa ] Using bit operations on Integers needs extra computations and

Os there a cannonical Windows 1.6 distribution?
4826 [Dave@th ma e] I was wondering if there is consensus out there on a Windows
4851 [charleshixsn] ...
4856 [andy@to ls e] I disagree quite strongly.
4860 [aleksi.nieme] I think we should provide both. Something small and easily installable, and
4863 [andy@to ls e] It sounds great.  Are you volunteering :-) ?
4864 [schneik@us i] #     >I really don't think that the CygWin installation should be
+ 4866 [andy@to ls e] - A developer's distribution.  Small, just core Ruby.  You've got
| 4867 [Dave@th ma e] - half carat Ruby?
| 4868 [schneik@us i] #     >Well, first of all, *some*  users are going to be put off no matter
| 4869 [Dave@th ma e] In that case, I'd like to move this forward.
| 4870 [andy@to ls e] That's only on DVD, right? :-)
+ 4902 [charleshixsn] ...

Real random number sites.
4831 [schneiker@ju] I thought those of you working with random numbers, random number
4835 [feldt@ce ch ] Thanks a lot Conrad! We plan to include one Rng in the Random lib that

IRC channel #ruby on EFnet
4832 [knu@id em ns] Is there any IRC channel for Ruby talk yet?  I've just created one on
4847 [aleksi.nieme] I've been around for quite some time. I've also asked if anyone else would

ruby-talk <-> comp.lang.ruby gateway trouble
4839 [nosuzuki@e- ] The gateway between ML ruby-talk and Newsgroup comp.lang.ruby stop

ruby-talk <-> comp.lang.ruby gateway trouble
4840 [schneik@au t] For those who want to see the latest ruby-talk ML (mail list) postings

Real random number sites.
4842 [schneiker@ju] I thought those of you working with random numbers, random number

Multiple hits for same message on ruby-talk search?
4843 [feldt@ce ch ] It'sgreat to be able to search the past archive of messages to ruby-talk
+ 4837 [matz@ze ab t] The following message is a courtesy copy of an article
+ 4846 [aleksi.nieme] I need the search tool too, and got way too annoyed, so I created a script
+ 4852 [charleshixsn] ...
+ 4862 [schneik@au t] Well, to search for stuff that doesn't predate the comp.lang.ruby <->

4845 [hirokaz@mc n] *大儲けシステム説明書*

ANNOUNCE: HEADS UP: IRC channels for Ruby talk
4848 [knu@id em ns] Okay,
4874 [hfulton@au t] After all... Ruby is the universal language... ;)

FEATURE REQUEST: Fixnum bitfields
4849 [wscott@ic ip] array[index]       access one element of array
4850 [matz@ze ab t] Do you mean 0xbabe[16,8] returns 0xba?
+ 4853 [charleshixsn] ...
+ 4854 [wscott@ic ip] Well actually, 0xbabe[8,8] returns 0xba.  The bits start counting at
  4857 [wscott@ic ip] I just realized that the '[]=' is not implimented for Fixnum and Bignum.
  + 4858 [andy@to ls e] some time ago.  It was a quick hack, and I make no guarantees
  | 4873 [m_seki@mv .b] class Bits
  + 4859 [wscott@ic ip] I bet you can't impliment '[]=' for Fixnum because it is an immediate
  + 4871 [matz@ze ab t] I don't think it's possible, since Numbers are immutable.
  | 4872 [Dave@th ma e] Morning, Matz!
  | 4881 [matz@ze ab t] Fixnum#+ returns new fixnum.  But you probably want
  | 4882 [Dave@th ma e] True, but you could do it with
  + 4875 [hfulton@au t] Oh, really, don't you think this is a bit much? When
    4877 [wscott@ic ip] This allows you to simply use a bignum as a very compact array of
    4878 [andy@to ls e] See?  What a popular concept :-)
    4893 [kjana@os xa ] ....And yet another :-)

Windows installation issues, etc.
4876 [hal9000@hy e] ...
+ 4879 [Dave@th ma e] True, but the Linux-based install is trivial compared to
+ 4880 [Dave@th ma e] That was a good point. I went and checked. CYGWIN is distributed under
| 4896 [schneik@au t] <Lots of snipping, including extended license quote.>
| 4904 [charleshixsn] ...
+ 4890 [bombadil@wa ] What about Debian packages?

Re-binding a block
4883 [Dave@th ma e] I'm probably missing something obvious, but...
4884 [matz@ze ab t] Here's the trick.  Don't tell anybody. ;-)
+ 4885 [Dave@th ma e] Ah! Punctuation!
| 4886 [matz@ze ab t] I said don't tell.
+ 4887 [Dave@th ma e] Now, say I wanted to make it more complicated and pass parameters in
  4888 [matz@ze ab t] I don't think it's good idea to change instance_eval.  How about this
  4892 [Dave@th ma e] Unfortunately, sing instance methods doesn't quite work for me.
  + 4894 [yashi@ya hi ] maybe i'm missing something but why not just use alias?
  | 4895 [Dave@th ma e] I'm trying to do something more generic, and that also avoids the
  | 4899 [matz@ze ab t] How about this?  Although it's bit ugly.
  | + 4901 [Dave@th ma e] I'd hoped to avoid passing blocks as strings -- using real code blocks
  | | 4911 [matz@ze ab t] Negative.  I don't feel it as `instance_eval'.
  | + 4905 [yashi@ya hi ] sub classing kills your code... :(
  |   4907 [Dave@th ma e] What I'm hoping to produce is a standard way to hook Ruby methods
  + 4897 [matz@ze ab t] Hmm, I don't think it's possible by plain Ruby.
    4906 [Dave@th ma e] This is the version that makes no attempt to execute the function in

4891 [decoux@mo lo] I've written this small module, just to play with ruby.
4898 [aleksi.nieme] Dear Guy,
4900 [decoux@mo lo] Yes, this is just a simple interface to pre&post conditions.
4909 [andy@to ls e] Well now you've let the cat out of the bag :-)
4910 [aleksi.nieme] Great! Looks really awesome.
4912 [andy@to ls e] Thanks!
4913 [decoux@mo lo] why do you need to read and parse the source ?
4914 [andy@to ls e] To be brutally honest; I don't recall :-)  Dave and I have been
4915 [decoux@mo lo] I still don't understand sorry.
4916 [andy@to ls e] Ah!  I think I see the difference -- my version is entierly in
4917 [decoux@mo lo] Yes, this is the difference
4919 [hal9000@hy e] Well, all I can say in response to all of this