69942-71079

69703-70768 subjects 70075-70780

open 'no-exist' rescue true - idiom
69942 [ahoward@fs .] rubyists-
69943 [B.Candler@po] I use 'rescue nil' which is only one character less :-)
69947 [ahoward@fs .] i like that better actually.  it seems to read - 'rescue by doing nothing'.

grep and regular expressions in ruby
69956 [kpd@kr sh ad] I'm quite taken with ruby, but recently I ran into trouble using grep. I
+ 69958 [rodrigo.berm] ar.select {|e| e =~ /cat|small/ }
| 69960 [dcarrera@ma ] ?>
| + 69962 [kpd@kr sh ad] Thanks Bermejo and Daniel.
| | 69964 [rodrigo.berm] I widely  recommend you (if you are a newbie) the 'Sam's Teach Yourself
| + 69963 [michael_s_ca] Does the "!~" operator help you out here?
| | 69965 [dcarrera@ma ] 1) That only solves a small subset of the problems I'm referring to.
| + 69979 [ahoward@fs .] </snip>
|   + 70024 [wkb@ai ma l.] Ara,
|   + 70029 [wkb@ai ma l.] Ara,
+ 69971 [dave@pr gp o] Have you had a look at lib/eregexp? It doesn't quite do what you need,
+ 69983 [B.Candler@po] To make this run I had to add some $ signs in front of your variable names
| 69987 [batsman.geo@] => nil
+ 69990 [matz@ru y- a] ar2 = ar.select{|x| /cat/ =~ x and /small/ =~ x}

two oddities in ruby 1.8.0p2
69957 [davekam@po o] OK, recently a cool feature has been added to ruby to start assigning
69984 [B.Candler@po] Oh, it has been discussed many a time :-)
70037 [davekam@po o] Oh, right... yeah, if I knew it had anything to do with that, I could
70040 [B.Candler@po] Well, I agree that it's a declaration in all but name :-)
70343 [qrczak@kn .o] Or forcing to write x() for nullary methods without a receiver.

Subject: Re: [ANN] Ruby.shop
69969 [jweirich@on ] UML uses the convention that any arrow will point in the direction of a
69970 [hal9000@hy e] OK, I see. So my blue arrows already follow that convention,
+ 69972 [dave@pr gp o] dave[Work/rubybook 1:59:09] irb
| + 69973 [hal9000@hy e] Sure, the class of Object is Class... or
| | 69975 [nemo@he lo r] Object is a class, yes.  But objects are not classes.  Are you documenting
| | 69992 [hal9000@hy e] Class.
| | + 70008 [nemo@he lo r] Hmmmm. Well, I have always perceived some circularity
| | + 70009 [nemo@he lo r] Hmmmm. Well, I have always perceived some circularity
| | + 70010 [nemo@he lo r] Hmmmm. Well, I have always perceived some circularity
| | | 70022 [hal9000@hy e] everyone
| | | 70026 [nemo@he lo r] But as for arrow color: Is it not worthwhile distinguishing
| | | 70027 [hal9000@hy e] this
| | | 70030 [nemo@he lo r] True. I'm still inclined to distinguish on the
| | + 70012 [batsman.geo@] You need two kinds of relations so the directed graph becomes a semantic
| + 69976 [nemo@he lo r] dave[Work/rubybook 1:59:09] irb
|   70005 [dave@pr gp o] irb(main):001:0> Object.class
|   70006 [nemo@he lo r] FWIW, I understand that :)
+ 70004 [jweirich@on ] I had to fire up IRB to investigate this.  Remember, there are different

L'immobilier au Qu?bec
69974 [quebec-immo@] ...

parsing large file into matrix
69977 [qubert@au ti] I work on a lot of flat files containing data with many columns
+ 69981 [vjoel@PA H. ] How about this?
| 69994 [bob.news@gm ] "Joel VanderWerf" <vjoel@PATH.Berkeley.EDU> schrieb im Newsbeitrag
+ 69996 [B.Candler@po] x = File.open("file.txt").readlines.collect! do |line|
  69999 [bob.news@gm ] "Brian Candler" <B.Candler@pobox.com> schrieb im Newsbeitrag
  70090 [jim@fr ez .o] /\t/ is faster
  70106 [bob.news@gm ] "Jim Freeze" <jim@freeze.org> schrieb im Newsbeitrag
  70107 [jim@fr ez .o] Sorry, I don't understand. Are you trying to capture the comment
  70117 [bob.news@gm ] "Jim Freeze" <jim@freeze.org> schrieb im Newsbeitrag
  70121 [jim@fr ez .o] Very clever. I did not catch that at first.
  70128 [bob.news@gm ] "Jim Freeze" <jim@freeze.org> schrieb im Newsbeitrag

Ruby mode for Emacs...
69998 [Stephan.Kaem] while I'm not new to Ruby, to Emacs I admit I am.
70001 [nobu.nokada@] These are all warnings, not errors.
70053 [Stephan.Kaem] 8< Lines of questions and advice snipped...
70120 [drejewic@ws ] Yes, I love Emacs too.
70184 [gordonhartle] Even better, rather than counting the lines, set mark on the first
70253 [ jimm@io co ] I have been using Emacs for twenty years, and learn something new all the

Using objects persistence
70000 [spectra@de i] Have anybody used any objects persistence mechanism in Ruby? Something like
70003 [bob.news@gm ] robert
70023 [pablo@lu a. ] Hm... fine links, but not quite what I am interested in...

Error in ruby extension
70002 [stevehart@be] Question related to extending ruby
+ 70013 [batsman.geo@] You are completely right, Ruby isn't thread-safe and there's not much
| 70290 [stevehart@be] Thanks for the confirmation Mauricio - I can work around.
| 70330 [batsman.geo@] The upcoming new Ruby (bytecode) interpreter.
+ 70014 [stevehart@be] In answer to my own question and in hope of confirmation, it would appear

How to call an object instance's method?
70015 [pooh@cs tu b] Dear Ruby Experts,
+ 70016 [bob.news@gm ] "Rene Tschirley" <pooh@cs.tu-berlin.de> schrieb im Newsbeitrag
| 70019 [pooh@cs tu b] Oh, shit. I knew, it would be something really stupid. :-)
| 70021 [dblack@su er] Well, the language has changed in this area, and the book (assuming
| 70028 [B.Candler@po] Thanks for that explanation. FWIW I think it's really a bad idea for
| + 70038 [michael_s_ca] I agree, and not just because I highly respect Mr. Candler's
| + 70044 [matz@ru y- a] Don't.  And if you don't, you will be happy.
|   + 70048 [nemo@he lo r] "puts (a+b).abs" as "(puts(a+b)).abs" really made me mad.
|   | + 70050 [matz@ru y- a] True for my eyes.  Perhaps my eys are influenced too much by Ruby.
|   | + 70052 [dave@pr gp o] But then again there's
|   |   + 70072 [nemo@he lo r] But then again there's
|   |   | 70123 [michael_s_ca] Uh-oh... isn't this what...Python does?  Ick.  I agree that this
|   |   | 70124 [B.Candler@po] I think it's that it doesn't Do The Right Thing[TM], i.e. in this case you
|   |   | + 70125 [tim@ba es id] I think it would break bucketloads of old code, and make the language look a
|   |   | + 70126 [dblack@su er] I don't like the latter (the disallowing of parens), partly because it
|   |   | | 70127 [B.Candler@po] I think clarity is certainly the problem here. Are parens just part of the
|   |   | + 70129 [michael_s_ca] Anything that *requires* poetry mode I'm against, as I'm against
|   |   | | 70131 [B.Candler@po] You mean you would prefer
|   |   | | 70138 [michael_s_ca] Between that and not *ALLOWING* ()'s for method/function calls?  Absolutely.
|   |   | + 70132 [nemo@he lo r] - the 1.6.8 behaviour is better, or
|   |   |   70137 [B.Candler@po] That means: all method calls must have parentheses around their arguments.
|   |   + 70104 [bob.news@gm ] "Dave Thomas" <dave@pragprog.com> schrieb im Newsbeitrag
|   + 70055 [B.Candler@po] Yes, that I can sympathise with. It upsets poetry mode if the first
|     70082 [nobu.nokada@] You can use begin..end instead, always no ambiguities :).
|     70100 [B.Candler@po] Hmm, that's new to me... but I don't think that's argument grouping, as it
+ 70020 [B.Candler@po] That's not what you've done; you have filled aList with the *class* A. Try
  70049 [pooh@cs tu b] Now, as I think about that, that opens a new dimension of what's possible
  70051 [B.Candler@po] I found the Pickaxe the only book I needed. However the web version is not

MathN
70017 [dave@pr gp o] I'm trying to get to grips with the 'mathn' library. I can see what it
+ 70264 [unet@re x. o] In math, 7 is an integer.  It is also a rational
| 70266 [jim@fr ez .o] The above seems very interesting, but it is not clear to me
| 70571 [unet@re x. o] Sure.  I am making a class Pnom of polynomials in
| + 70582 [unet@re x. o] That was pretty slick, wasn't it?  Such slickness
| | 70588 [michael_s_ca] How'd you find the bug (or rather, that there WAS a bug)?  Unit tests?
| | 70591 [unet@re x. o] Yep, unit tests.  The new Test::Unit in the Ruby 1.8 preview
| + 70944 [jim@fr ez .o] Thanks for the explanation. This actually looks like
|   71079 [unet@re x. o] Hmmm...interesting idea.  I'm not sure what the
+ 70568 [unet@re x. o] Let me try again, since the usenet gremlins seem to have intercepted
  70569 [dave@pr gp o] That's an excellent set of examples. If you don't mind, I might borrow
  70579 [unet@re x. o] I'd be an honored piggy.  After all, you and Andy are the ones

[ANN] FXRuby-1.0.22 Now Available
70018 [lyle@kn lo y] All,

Design By Contract.
70025 [kenosis@at b] Several months ago, I made a posting regarding a possible enhancement to
+ 70031 [stef@ch on z] Several months ago, I made a posting regarding a possible enhancement to
| 70092 [mailinglists] have you ever done "Design by contract". I'm working with eiffel 8
+ 70105 [bob.news@gm ] "Ken Hilton" <kenosis@attbi.com> schrieb im Newsbeitrag
| + 70109 [mike@wy r. r] I always saw DBC as the combination of pre-, post-, and loop variable-
| | 70115 [bob.news@gm ] "Mike Wyer" <mike@wyer.org> schrieb im Newsbeitrag
| + 70114 [ndrsbngtssn@] Static types and contracts are almost orthogonal, since contracts are
+ 70118 [feldt@ce ch ] On a somewhat related note I wanna mention my thesis which
+ 70142 [Stephan.Kaem] Dave did some work on it. You'll find it @

(none)
70032 [orion2480@ho] # summary

[OT] Re: grep and regular expressions in ruby
70033 [ahoward@fs .] it it interesting - i've filed it in my 'interesting' folder ;-)

block.call vs. yield
70034 [orion2480@ho] I noticed that the use of block/yield differs slightly when a "break" is
70046 [matz@ru y- a] You've found something unnatural.  Let me examine.
+ 70047 [orion2480@ho] Let me specify the version numbers I have tested this on, in case it makes a
+ 70087 [matz@ru y- a] As a conclusion, you will have compatible behavior when you use
  + 70089 [nemo@he lo r] As a conclusion, you will have compatible behavior when you use
  | 70091 [dave@pr gp o] It's documented in the new ri (basically parameter passing conventions)
  | 70195 [nemo@he lo r] different
  | 70198 [decoux@mo lo] Because there are 2 differences between #call and #yield : one affect
  | 70209 [nemo@he lo r] * eval.c (proc_invoke): Proc#call gives avaules, whereas
  | 70239 [decoux@mo lo] You'll find in ruby mrhs, mlhs, massign for 'a, b, c = d, e, f' and
  + 70113 [dblack@su er] 'yield' as a method name for blocks strikes me as awkward.  In the
    + 70170 [matz@ru y- a] Sorry I don't understand.  Do you mean you don't want a method with
    | + 70171 [james_b@ne r] What I got from David's comment, and what the word 'yield' suggests to me,
    | | 70172 [hal9000@hy e] because
    | + 70176 [ptkwt@sh ll ] That's OK.  Sometimes we wish we were born in a Japanese speaking country
    | + 70178 [dblack@su er] The follow-ups captured most of my meaning, but I'll follow up myself
    |   + 70181 [matz@ru y- a] Hmm, understandable.  It's not obscure for me at all though.
    |   | + 70185 [dave@pr gp o] vocating, of course; it's just that
    |   | | 70186 [decoux@mo lo] If someone read the source he'll have problems to understand what do ruby
    |   | | 70187 [matz@ru y- a] ;-)  In that case, I will rename those functions.
    |   | + 70188 [JohnFeezell@] Here are a few ideas about names.  They maybe all wrong since I may have
    |   + 70296 [gsinclair@so] Two arguments for accepting Proc#yield.
    |     70300 [dblack@su er] There's some precedent for receivers as "direct objects" of the verbs
    |     70302 [gsinclair@so] Hmmmm, I think you're right.
    + 70182 [hal9000@hy e] I now see what David is saying. I had failed to
      70189 [dblack@su er] I think that if the semantics of yield are to be generalized, they
      + 70190 [matz@ru y- a] Iff you can name it a good name.
      | 70321 [pbrannan@at ] I'm curious why you feel we need a method to do this.  Why is the yield
      | 70328 [matz@ru y- a] Some, for example dRuby, requires the method.
      | 70332 [dblack@su er] I know there must be an obvious answer to this, but...  what is an
      | 70401 [matz@ru y- a] Proc#yield cannot be implemented using Proc#call, and other way
      + 70219 [hal9000@hy e] call_as_block perhaps?? or just call_block ?
      | 70220 [dblack@su er] If Proc#call has method-like semantics, perhaps what's needed is a
      + 70293 [gsinclair@so] The method name :yield was immediately intuitive to me, as was the
        + 70294 [B.Candler@po] I am in that group. I have been caught out several times by writing
        | 70295 [gsinclair@so] And that's very ugly, IMO.
        | 70297 [matz@ru y- a] I know, but I have to solve them one at a time.  FYI, I proposed
        | 70352 [B.Candler@po] I certainly agree there :-)
        | 70357 [matz@ru y- a] 'yield semantics' is assignment between block parameters and yield
        | 70363 [B.Candler@po] Ah, right. So if you were to change that, you'd probably also have to get
        | 70389 [jbshaldane@h] If we are keeping the yield and call argument handling different, then
        | 70400 [matz@ru y- a] I'm not sure call/yield difference belong to caller or callee.  If it
        + 70298 [dblack@su er] I'm not seeing why that's the only choice.  How about finding a
          70301 [gsinclair@so] blk.call_but_collapse_surplus_arguments_into_the_final_parameter_as_an_array

>-) DIGIT WORLD CONTEST HERALD # 1?=
70035 [johann-manet] (http://www.esclarmonde.org)

Regexp behavior with character class
70036 [jim@fr ez .o] Is this correct for 1.8.0?

Accessing Ruby class from C extention
70039 [ptkwt@sh ll ] I know it's possible to write Ruby in C but is it possible to instantiate
70041 [nemo@he lo r] Maybe I'm not understanding, but can't you just call `new' on the class you
+ 70043 [nemo@he lo r] Maybe I'm not understanding, but can't you just call `new' on the class you
| 70054 [ptkwt@sh ll ] Hmmmm.... but how does the C side 'know' where my Ruby class is defined?
| 70059 [ptkwt@sh ll ] OK, I tried it and that is how it seems to work.
| + 70065 [gfb@to es ft] You can get the value of constant "Foo" (seems like rb_gv_get() will do the
| | 70066 [gfb@to es ft] yet
| + 70067 [nemo@he lo r] It seems like to call the constructor of a Ruby class from C that you
+ 70045 [ptkwt@sh ll ] I want to call 'new' on the class on the C side.  The more I think about
  + 70056 [B.Candler@po] Why? There's nothing particularly special about calling the 'new' method of
  + 70061 [0bz63fz3m1qt] Its possible, I do it myself all the time.
    + 70069 [ptkwt@sh ll ] Thanks.  There's also a third way using rb_eval_string.  Now I see how you
    + 70084 [nobu.nokada@] "Test";
      70086 [0bz63fz3m1qt] agree
      70559 [namille2@vt ] Is your tutorial online? I did a quick google search for it, but could find
      70610 [0bz63fz3m1qt] I will :-)
      70669 [botp@de mo t] or mozilla (the text bleeds outside the boxes).
      70686 [0bz63fz3m1qt] OK.. For the code-pieces I have converted
      70687 [botp@de mo t] nope, same bad result for opera and mozilla..  but the boxes fit on ie :-)
      70689 [0bz63fz3m1qt] I have an old Mozilla-1.2b + konquorer-3.0.5 and it looks ok.
      70690 [botp@de mo t] you are right :-)

asynchronous ruby
70042 [student_vien] I have a big dll which is working with sockets and
70057 [B.Candler@po] If you don't like the answer you got first time round, simply asking the
+ 70060 [offstuff@ao ] hm,...
| 70073 [matz@ru y- a] Pretty interesting.  I'd like to hear about how other languages solve
| 70102 [student_vien] some text about tcl and manage events...
| 70111 [B.Candler@po] Ruby handles signals in the same way. If it's in the middle of doing
| 70122 [offstuff@ao ] afaik, ruby is not thread-safe.
+ 70063 [aredridel@nb] Wouldn't having a ruby-interface thread do the job?  Just have the

test unit problem
70062 [jbshaldane@h] Is it me, or is this a Test::Unit bug?
+ 70070 [ptkwt@sh ll ] I'm seeing something similar with ruby 1.8 whereas it worked fine with
| 70071 [sdate@ev re ] Same errors on : ruby 1.6.8 (2002-12-24) [i586-mswin32]
+ 70077 [nathaniel@NO] <snip error>
  70093 [jbshaldane@h] Ok, sorry for being too hasty, I wasn't sure if the email address was

Hashes and Enumerable#each_with_index
70064 [rpav@nw in .] OK, looking at the archives I know this was discussed a few years ago,
+ 70068 [dblack@su er] One problem I see is: how could you implement this, in Enumerable, in
| 70094 [rpav@nw in .] I don't see why there must exist a default implementation in
| 70110 [dblack@su er] If it applies to "any given Enumerable", then presumably it's defined
+ 70074 [matz@ru y- a] No.  Index in each_with_index means offset of the values.  It might be
| 70095 [rpav@nw in .] I actually don't really care here... new name (the each_with_key
| 70096 [matz@ru y- a] I'm positive.  But describe what you want more precisely.  The
| + 70097 [rpav@nw in .] David Black (iirc) had a good suggestion on #ruby-lang, and that was
| | 70108 [dblack@su er] It was flgr -- not sure who that is though.
| + 70098 [dave@pr gp o] Or, have each class that wants to support this protocol define a method
|   70141 [rpav@nw in .] This is perhaps an OK default, but it would be nice to see a O(1)
+ 70076 [djberge@qw s] This operation seems most sensical, to me, when used with ordered
| 70085 [hal9000@hy e] Hmm, not a good idea in general, I think.
+ 70099 [B.Candler@po] Or indeed just 'h.each' (if you replace |o,i| with |i,o|)
+ 70199 [sroberts@un ] This function already exists, for a Hash its called Hash#each.
  70202 [dblack@su er] Not exactly: Hash#each returns [k,v] pairs, not [v,k] pairs.  The
threads.html
top