18378-19183 subjects 18867-19460

Accessing argc,argv,environ from a ruby extension?
18638 [Laurent.Jull] I'm puzzled by this one.  I'm writing a Ruby extension in C and I need
18639 [decoux@mo lo] The first letter of ENV is [A-Z], this mean this is a constant :-)

use of antique C idioms in Ruby source/extensions?
18640 [ned@bi e- om] I just started looking at the Ruby source (and have seen some examples of
18656 [matz@ru y- a] Because I prefer that.  Yes, I'm an old-timer.  But when I rewrite the

Possible SWIG Ruby bug
18641 [Craig_Files@] It seems that when using SWIG with Ruby, there is a bug that causes a destructor for an object to be called more than once.  If an object is newed
18994 [Craig_Files@] After get no response, I thought that I would try to determine if this was a SWIG or a Ruby bug.  It is a SWIG bug, in that

discrepancies between prototypes and definitions?
18642 [ned@bi e- om] Looking more at the Ruby 1.6.4 source, I note that some functions are
18657 [matz@ru y- a] Because I don't want to include <sys/types.h> everywhere for fd_set.

Installation tool for ruby-only modules?
18644 [larsch@cs au] I am looking for a way to provide easy, preferably portable installation
+ 18645 [the-master-o] Try setup.rb from the RAA
+ 18649 [neumann@s- i] setup.rb by Minero Aoki is such a program.
+ 18659 [wjl@mi dl ss] You probably just want to put your ruby file in your site-ruby/version

Converting | to a Proc object?
18648 [onge@mc .a l] I'm probably just being dense here, but how do you convert Array#| to a
+ 18650 [neumann@s- i] You have to create a Method object before.
+ 18653 [Dave@Pr gm t] Try

Hello from new ruby user
18660 [ned@bi e- om] I just joined the ML and started looking at Ruby. I got the Pickaxe book and
18663 [ptkwt@sh ll ] The way Ruby is growing you might not have to limit your Ruby proramming

How to collect question
18662 [dtillman@oz ] some questions.
18683 [dblack@ca dl] Always glad to see a new Dav* :-)
18700 [dtillman@oz ] HTMLtable.new(some_array)

IOWA: Questions
18665 [SAT@MU TI EC] ...
18687 [julian-ml@be] Avi's away on holiday at the moment but I can jump in and answer some of your questions (though he know the innards way better than I do).

Re: ruby-mode.el  was: ruby indenter
18666 [kero@d4 50 u] btw, what ruby-mode.el does depends on the ``perfect'' indentation; it
18678 [matz@ru y- a] Yes.  But since I no longer program in emacs lisp, and have been too busy
18682 [sean-ruby-ta] Not to start an editor war or flamage, but is there another=20
+ 18684 [matz@ru y- a] I've heard some other editors have ruby mode too (JED for exmaple).
| 18685 [sean-ruby-ta] =20
| + 18686 [Dave@Pr gm t] (Dave shudders at the thought :)
| + 18690 [matt@gr en i] Well, I use vim for everything, myself. I don't know how its Ruby mode stands up to emacs, though. I just can't grasp a lot of things about emacs, myself. (And I'm not sure there's a version for my primary "do stuff machine" at home. It's a Mac Quadra running System 7.5.5... ;)
|   + 18708 [hotfusionman] Try Marc Parmet's port of GNU Emacs 18.59 at
|   + 18747 [neumann@s- i] Vim 6 has automatic indentation while you are writing.
+ 18688 [info@mj is d] AFAIK there is jedit (www.jedit.org) which also support Ruby

list trouble, mail stucked
18677 [matz@ru y- a] Due to list server problem, some mails are not delivered.

programming contest
18679 [joe@vp p. et] Contest entrants will have exactly 3 days, from Thursday, July 26

Re: Ruby equivalent of htons() and htonl()
18681 [phasis@ha an] You can define functions like following

non-blocking File#eof (was Re: Non-blocking socket use in threads?)
18689 [grady@xc .b ] Whoops, sorry.  You're right.
18695 [decoux@mo lo] Just add a flag (FMODE_PIPE, or ???), and test this flag in rb_io_eof()
18698 [matz@ru y- a] Well, I think the point is what we should check by IO#eof, i.e. if IO

dbi and class design question
18692 [info@mj is d] I am writing a little vocabulary trainer with ruby,  and postgresql
+ 18696 [neumann@s- i] It's bad this way. Each method has it's own connection.
+ 18697 [Dave@Pr gm t] Yet one more idea, which is probably better in most circumstances, is
  18702 [neumann@s- i] require "dbi"

Possible threading problem under Windows
18699 [Dave@Pr gm t] I'm working on getting Rubicon to run to completion under Windows, and
18701 [erne@po er a] I ran your code under Win2k
+ 18726 [Dave@Pr gm t] Was that a 1.7.1? I just tried 1.6.2, and it works fine, but I haven't
| + 18728 [joe@vp p. et] Yes!  This was brought up for perl at an O'Reilly conference once.
| | 18748 [ned@bi e- om] Perl, at least, has a standard distribution format (two of them!), which
| + 18798 [erne@po er a] Yup!
+ 18738 [mikkelj-anti] The automated testing sounds nice - and certainly would be visible outside
  18746 [Dave@Pr gm t] The existing Rubicon tests have some elementary checks for this

HTML Librarys and OOP Design Philosophy
18704 [dtillman@oz ] Long Post!
+ 18705 [nat.pryce@b1] A rule of thumb is to avoid cyclic dependencies between classes and never
+ 18706 [ned@bi e- om] You look at responsibilities and roles. Why should an Array know anything
  18721 [mikkelj-anti] This is a very good question. But before you ask it, you should also ask

Re: HTML Libraries and OOP Design Philosophy
18707 [ned@bi e- om] The part about "in different modules" is important here. Since in most

Good ruby folding support for Vim6?
18709 [ned@bi e- om] There seems to be good support for indenting Ruby in Vim6 already. Has anyone
18710 [neumann@s- i] Yes, I have.

Problem installing IOWA
18724 [ruby@ja es r] I've  downloaded the IOWA package, and have tried to install it
18727 [julian-ml@be] Hrmr... I haven't seen this problem before.  Avi is the main guy on Iowa but he's away at the moment... I'm sure he'd know what your problem is instantly.
+ 18729 [james@ja es ] I've installed other packages, but it appears that only IOWA has
+ 18733 [neumann@s- i] install.rb depends on the global variable $sitelibdir.
  18745 [james@ja es ] Thank you! The new version worked fine on Windows and Linux.

Apache for windows
18730 [webmaster@li] Is there a mod_ruby for Apache for windows?
18801 [sean-ruby-ta] I don't believe so.  Check out www.modruby.net for more details=20

Numbers classes.. Rational number? [was: Ruby as opposed to Python?]
18732 [kentda@st d.] I second that proposal.
+ 18734 [kero@d4 50 u] 1 Dutch guilder is wordt 2.20something Euro.
+ 18736 [mikkelj-anti] First to the earlier argument about "those who grew up with statically typed
| + 18739 [kero@d4 50 u] Seems better than 5 / 2  => Rational to me.
| | 18744 [fgp@ph o. rg] I like the idea of built-in rationals.
| + 18750 [johann@ph si] Really?  How does that work?  At this point, I'm just curious.
| | + 18753 [kero@d4 50 u] because 6/3 = 6*1/3 and 6*2 = 6*1*2 ?
| | + 18763 [mikkelj-anti] I may not be entirely correct in my previous statement about (+, -, *, /)
| | | 18773 [fgp@ph o. rg] integers mod x are a field when x is a prime number, otherwise its a ring.
| | + 18839 [johann@ph si] Actually, the conclusion should be that (1/3) = 2 and that 6 = 1.
| |   18841 [fgp@ph o. rg] right.
| + 18756 [linden@wi .t] Of course, the number 1.0 is imprecise so you don't loose accuracy. What
|   + 18757 [kero@d4 50 u] No, I argued against any automatic conversion at all. But that is
|   + 18787 [pdcawley@it ] Ooh... real numbers that carried information about precision would be
|     18838 [johann@ph si] Right.  I worked this out right after I posted that.  Algebra is fun,
+ 18741 [kentda@st d.] It looks like a float, but are you sure 2.20 can be represent accurately
| + 18752 [mikkelj-anti] A different pretty cool number class is interval arithmetic.
| | + 18754 [kero@d4 50 u] That's what I'd need to convince my roommate to try Ruby :)
| | + 18755 [jmichel@bo e] Unfortunately, interval arithmetic is a nice idea which does not work in
| |   18764 [mikkelj-anti] Yes this is a major problem. I was under the impression that there had been
| + 18786 [pdcawley@it ] Except it's not. All of the various Euroland currencies <-> Euro are
+ 18743 [matz@ru y- a] It is bundled in the standard distribution (well, I should finish

Re: Ruby and (native) Event Loop
18737 [kero@d4 50 u] Tk thread can block Ruby, since it is a native (or at least non-Ruby)

Comment support in shellwords.rb
18749 [larsch@cs au] ...

Problem behaviour of 'singleton' library with thread
18751 [atsang@hk li] I am playing around in irb and find the following abnormal behaviour with
18772 [matz@ru y- a] The singleton block other threads during object allocation, to avoid

int/int => ???
18758 [paulp@Ac iv ] You are certainly entitled to that opinion and many Python people agree
18761 [nat.pryce@b1] Explicit notation is a good idea. Eiffel has two division operators.  The /
18769 [paulp@Ac iv ] These are basically the rules that Python will have "one day".

Autoflush backquotes??
18760 [ugly-daemon@] I am trying to get the backquotes to print everything "as it comes" instead of
+ 18766 [harryo@zi .c] Perhaps this isn't as neat as you'd like, but you can do something like ...
| + 18777 [ugly-daemon@] The first one works, the second one won't. You're right it's a bit ugly but it
| + 18789 [r2d2@ma .a c] There shouldn't be any .each here, just system("...") will do it. The
|   18800 [ugly-daemon@] Ahh, that's even better, I didn't realize system did that. I just thought it was
+ 18770 [Dave@Pr gm t] You won't be able to use backquotes here, because backquotes wait for
+ 18771 [matz@ru y- a] def make(action)
  18776 [pc000@pa st ] Chris,

Guide to using class loading (or similar concepts) in Ruby?
18762 [JamesArendt@] I'll be quite honest I'm quite a Ruby newbie and haven't had much
+ 18765 [harryo@zi .c] Yes, you will :-).
| 18821 [JamesArendt@] Both of those makes sense and would mostly achieve what I need. The
+ 18767 [nat.pryce@b1] In Ruby you load entire files rather than individual classes.
  18775 [fgp@ph o. rg] Has anyone written a library or module which enables Marshal to
  18778 [ned@bi e- om] How would you do this in general? Since Ruby classes and methods can come
  18797 [nat.pryce@b1] which
  18802 [fgp@ph o. rg] Is it possible to define a callback which is called every time a class

Re: Ruby vs. Objective Caml
18768 [mikkelj-anti] Ruby
18856 [matju@sy pa ] Ruby's example could be more compact if it didn't carry all of this dead
18860 [billk@ct .c ] (had intended to add this to the rubygarden wiki, but kept getting
+ 18861 [Dave@Pr gm t] Sorry about that - I had a disk fill up, and it looks like the error
| 18862 [billk@ct .c ] Thanks!  It's now at: http://www.rubygarden.org/ruby?RubyShapeExample
+ 18864 [jweirich@on ] Wow, that Shape example has really gotten some mileage out of it.  The
+ 18891 [zickzack@me ] The new version is indeed shorter and cleaner. However, the Ruby
+ 18976 [matju@sy pa ] class Class

Re: 99 bottles of beer
18788 [flifson@cs u] I tried to submit but unfortunately the page is not being updated
18790 [tammo.freese] def beer?

ruby-orbit support server side
18791 [MAP2303@ma l] I've relased ruby-orbit new version(20010730).

Assistance needed with Ruby article
18793 [thomas.oster] I'm looking for some assistance in connection with a Ruby article I'm

gsub!(//n, '')  What's the /n modifier do?
18794 [sean-ruby-ta] I was looking through cgi.rb and noticed a /n modifier and I
18795 [decoux@mo lo] By default the regexp engine use the character code defined by $KODE.

pre-alpha (at most) announcement: Ruby Behaviors
18803 [dblack@ca dl] Ruby Behaviors

Printing significant digits past decimal point
18806 [jim@fr ez .o] How does one print a maximum number of significant digits
18809 [Dave@Pr gm t] For %g, the precision gives the number of significant digits, not the

Net::HTTP (downloading an image)
18810 [tobiasreif@p] when running the code below (as an exercise while learning ruby)
+ 18812 [Dave@Pr gm t] I just tried this and it worked fine here. You should get a 273x123
| + 18814 [tobiasreif@p] wow, that was quick ;)  (answer below)
| | 18820 [Dave@Pr gm t] Ah - you're on DOS. You need to open the output file in binary mode
| + 18815 [tobiasreif@p] Tobias Reif
+ 18813 [decoux@mo lo] Are you on an DOS system ?
| 18816 [tobiasreif@p] Guy,
| + 18817 [decoux@mo lo] "b" is for "binary", you must use it otherwise Windows make strange thing
| + 18823 [ned@bi e- om] What you're seeing is the result of a couple of two-decade-old bad design
+ 18831 [jjenning@st ] close the file after writing to it ;)

Numeric model
18824 [paulp@Ac iv ] I'm talking about *integer objects* being substutable for *float

Get a list of class (not instance) functions
18826 [fgp@ph o. rg] Is there a way to get a list of all the class functions of a
18828 [aamine@mx ed] (class << some_class; self end).instance_methods
+ 18829 [SAT@MU TI EC] Can someone please explain... :>
| 18834 [aamine@mx ed] (class << obj; self end) is general(?) mean to get obj's
| 18840 [fgp@ph o. rg] this gives you the class methods, but includes also the class methods of the
+ 18837 [fgp@ph o. rg] It works.... but I'm not sure that I understand why. Please tell me if my
  + 18857 [aamine@mx ed] You are almostly right.
  + 18878 [decoux@mo lo] Yes, bar_singleton is an instance of Class, and this is a singleton class

integer/integer division
18827 [paulp@Ac iv ] That code doesn't really use substitution at all. i.e. there is no point
18830 [wjl@ee by .e] double d = 5/2;

18832 [alwagner@ua ] Ruby164-2.exe does not work in my Win2k box.  Judging by other
18833 [Dave@Pr gm t] I have the 164-2 program running fine on W2k. I;ve tried it using the
+ 18835 [alwagner@ua ] I removed it a few days ago and went back to 1.6.3.  If I
+ 18845 [mikkelj-anti] cygwin + Ruby 1.6.4 does work with Fox.
+ 18882 [VardhanVarma] I tried compiling the native-win32 port of ruby, and it seems
| 18889 [ljohnson@re ] 1. None of the Net classes work; and,
| 18890 [alwagner@ua ] That's great.  Thanks, Lyle.  Looking forward.
+ 18898 [alwagner@ua ] is reinstalled.  Below are the error messages. Lyle

Re: Full screen I/O?
18842 [J.Travnik@sh] This will be problematic because I have removed some unnecessary

RCRs on RubyGarden
18843 [Dave@Pr gm t] As an experiment, I've created a wee RCR management system under the
18844 [dblack@ca dl] I think this is a good idea.  The RCR wiki area, for one reason or
18855 [matz@ru y- a] I hope so.  Although it's easier to discuss on the list, it's also

Dynamic ORBit bindings for Ruby
18846 [senderista@h] Purely coincidentally at almost the same time that Dai announced
+ 18858 [senderista@h] Sorry, I should have said all IDL types are supported EXCEPT fixed,
+ 18866 [MAP2303@ma l] First of all, I'm glad to see other people interested in Ruby ORBit.
+ 18899 [kom@ma l1 ac] I read the README of Dynamic-ORBit with great interest.  I am
| 18914 [senderista@h] Yes, I'm not particularly interested in ORBit or GNOME (except for
| 18998 [MAP2303@ma l] My code is more internally I think.
| 19052 [senderista@h] That's pretty much how my code works (I too only use the
+ 18918 [senderista@h] It would be *very* helpful to me if someone could provide an English
| 18920 [mikkelj-anti] Could any of you CORBA freaks :-) give a short introduction to
| + 18922 [nat.pryce@b1] Management of object lifetimes is left entirely up to the application
| + 18934 [senderista@h] The specifics of memory management for CORBA objects vary with each
|   18989 [mikkelj-anti] Both answers certainly are informative, but I should have guessed from the
+ 19118 [MAP2303@ma l] I try to download it, but it seems not to be exist.
  19152 [senderista@h] I just tried downloading this in Internet Explorer and it seems if you

Ruby vs. REBOL
18847 [cyoungbl@le ] I have been looking into REBOL (http://www.rebol.com/) lately and have found
18848 [hotfusionman] I've looked at REBOL a little over the past couple of years, and my conclusion
18880 [r2d2@ac .u u] I've also looked a bit at REBOL. Here are some interesting features
18902 [cyoungbl@le ] Agreed.  However, you can still use parentheses to force the order you want.
+ 18913 [mdemello@ru ] From when I looked at REBOL (admittedly a while ago) I got the feeling that
+ 18949 [andy.elvey@p] want.
  18982 [cyoungbl@le ] to

Rubywin uses hard-coded "/cygdrive" prefix.
18851 [ljz@as as .c] I just noticed today that the version of `rubywin' that comes with the
+ 18876 [ljz@as as .c] I'm following up to my own message to report that I just determined
+ 18879 [ljz@as as .c] Once again, I'm replying to my own message.  This time,
  + 18884 [yxw@cy re s.] I am a new user of Ruby. Could anyone please tell me why in the
  | 18893 [dblack@ca dl] Neither underlying object is copied, just the instance variables
  + 19018 [masaki.suket] Thank you. I have marged the patch.

Re: ruby versus Perl Magic (and major changes in Perl6)
18852 [ptkwt@sh ll ] I saw this in Larry's latest State of the Onion.  It really seems like
18853 [ned@bi e- om] One word: CPAN. The intention is to allow translation from Perl5 to Perl6 for
18871 [pdcawley@it ] Perl's *really* big win isn't so much CPAN as CPAN.pm. If you install

Windows' threads
18854 [aleksei.guze] Have anyone tried to make ruby supporting Windows' threads?

Re: Who can count change??
18863 [teespy@gm .n] ...
18912 [ugly-daemon@] It's always good to learn stuff :)
+ 18967 [r2d2@ac .u u] (Writing a program that returns the number of ways to make change for a
+ 19014 [stephen.hill] I've just looked at the original paper, and I am a little puzzled by
  + 19021 [ugly-daemon@] I understand it kinda/sorta but I am not good at explaining things. The
  + 19027 [r2d2@ac .u u] The are included when the recursion is applied to w[4,75]
  + 19065 [stephen.hill] Niklas,

Digits in method names
18865 [aleksei.guze] Why not allow starting method names with digits?
18896 [wjl@mi dl ss] class Integer
18901 [anany@ec .v ] Read about context-free grammars and the theory of compiler design and you
18903 [brucedickey@] Yes, in pure theory -- the theory of certain types of parsers, that is.
+ 18904 [anany@ec .v ] Indeed you are correct. Most parsers in use are one-character look-ahead due to
+ 18905 [ned@bi e- om] My impression is that typical parsers have one _token_ of lookahead, and that
  18906 [mikkelj-anti] number
  18907 [brucedickey@] Yes, and the lexer (speaking of a separate lexer and parser) has one
  18908 [brucedickey@] Good observations.
  18927 [aleksei.guze] Catch(:WM_QUIT){while msg.code!=PAUSE
  18947 [mikkelj-anti] I do not think there is any technical problem with identifiers starting with