3190-4066 subjects 3635-4024

Exercice: Translate into Ruby :-)
3410 [jilanik@ti .] I need a translation of this C++ code to understand how Ruby classes
+ 3412 [matz@ne la .] Is this what you want?
+ 3426 [nahi@ke na t] More C++ style(?) code I think is in inline...

Download song
3418 [oyubot@ti .i] Download song

Modules for namespace management
3419 [hal9000@hy e] Someone recently made a suggestion that I found
+ 3420 [aleksi.nieme] I think at least Dave has touched the subject at
+ 3421 [Dave@th ma e] 'twas I.

There is no "main" function in Ruby (?)
3422 [jilanik@ti .] ...Yes it is. Thank you.
+ 3423 [aleksi.nieme] When you execute the interpreter by saying something like
+ 3431 [Dave@th ma e] Ruby has an execution model which will seem strange coming from C++.
  3432 [nahi@ke na t] This looks good.  Can I show another soultion?

Re: Embedding RubyUnit
3433 [Dave@th ma e] Absolutely. (We should say that $DEBUG is set to true by the -d
3436 [nahi@ke na t] Ah, I should say so...  Thank you.
3476 [CQN02273@ni ] Maybe I think "ru" syntax is associated with RubyUnit. So,
3477 [nahi@ke na t] Kon'nichiha Suketa-san,
+ 3478 [Dave@th ma e] ;-)
+ 3491 [CQN02273@ni ] Kon'nichiwa NaHi-san,
  3497 [schneiker@ju] Would you all be willing to consider a somewhat less cryptic and somewhat
  3555 [nakahiro@sa ] Yes.  Too cryptic to confuse myself in the future...
  3617 [schneiker@ju] somewhat
  3648 [CQN02273@ni ] % rbtest myfile.rb # Too criptic to confuse?
  3651 [schneik@au t] I think that is OK too, since every new Ruby user soon learns that ".rb"

"What's New" on Ruby home page WRT comp.lang.ruby
3434 [schneik@au t] Under "What's New" on the Ruby home page, it says, "Vote for
3447 [matz@ne la .] Oops...

Static Typing( Was: Waffling between Python and Ruby)
3437 [olczyk@in er] First in defense of static typing.
+ 3440 [Dave@th ma e] One of the joys of Ruby is it's uncluttered syntax and simple
+ 3441 [schneik@au t] Well, that sounds like some pretty strong stereoTYPING of the people that
| + 3444 [olczyk@in er] And if you were to ask an Eiffel adherent, most would reply that
| | 3446 [schneik@au t] Maybe you were exaggerating for effect, but one expects that at least a few
| | 3451 [olczyk@in er] Any more  then passing the wrong type in an untyped variable?
| | 3453 [andy@To ls e] Okay, first of all, please note that when I started this off
| | + 3456 [schneik@au t] Well, some people don't think static typing is a joke. ... Oh, you meant your
| | | + 3457 [Dave@th ma e] The most compelling argument to me is "is it ain't broke, don't fix
| | | + 3459 [matz@ne la .] I'm watching you, brother.  And Ruby 9000 may have OPTIONAL static
| | + 3467 [quinn@py o. ] Right... dylan does this, with its concept of "specialization".  I haven't
| | + 3472 [olczyk@in er] Come on. You know. Everyone knows.
| | + 3473 [olczyk@in er] The reason I say that static typing is a part of DBC is because it is
| |   + 3482 [Friedrich.Do] DBC is not bound to static typing, and I think non static typed
| |   | 3498 [schneiker@ju] <Lots of stuff snipped.>
| |   | + 3509 [andy@To ls e] I don't think personal attacks are appropriate, nor do I
| |   | + 3512 [Friedrich.Do] Now even it the charta allows lenghty messages, it's IMHO unpolite to
| |   + 3483 [Patrick.Scho] I agree with Andy here. IMHO DBC and typing are two different things. We
| |   | + 3487 [frankm@ba ar] Agreed.  Dynamic typing is very useful for rapid development, and for
| |   | + 3568 [janneck@NO P] i agree with you completely on the value of dbc and static typing, but my
| |   + 3485 [frankm@ba ar] <394f3df8.639246156@nntp.interaccess.com>...
| |   | 3517 [vp.nousiaine] Static vs. Dynamic typing <> Strong vs. Weak typing vs. no types
| |   | 3570 [alwagner@tc ] Exactly what does DBC mean in the context of this thread?
| |   | + 3574 [Dave@Th ma e] I'm not sure if this is a straightforward question or a profound one
| |   | | 3576 [frankm@ba ar] Hmm ... isn't the whole point of Design By Contract to "fail fast"?
| |   | | + 3577 [hgs@dm .a .u] I'm not sure how one would solve this one.  It seems to me that the
| |   | | + 3579 [Dave@Th ma e] I don't believe that's the _emphasis_ of Dbc. My reading of Meyer, and
| |   | | | 3581 [frankm@ba ar] Maybe I was misunderstanding the original poster, but he seemed to be
| |   | | | 3583 [Dave@Th ma e] Not always (there are issues with polymorphism) but in general.
| |   | | | 3584 [olczyk@in er] There are no issues with polymorphism. This is what polymorphism
| |   | | | 3590 [Dave@Th ma e] OK - I understand.
| |   | | + 3593 [joachim.durc] Frank Mitchell <frankm@bayarea.net>
| |   | + 3575 [c.hintze@gm ] Design By Contract
| |   + 3592 [joachim.durc] I agree that contracts between a routine and a caller can be applied to
| |   | 3646 [rainer.joswi] Yes. But this can be inherited in a dynamically typed language
| |   | 3673 [joachim.durc] Ah, I didn't of think that. Thanks.
| |   + 4100 [SPAMBGONEmbk] Well, static type constraints (a better phrase than static typing) on
| + 3463 [charleshixsn] ...
+ 3443 [embed@NO PA ] Yes. This is highly unlikely to ever happen with Python, or Smalltalk, and
  3445 [Dave@th ma e] Or Javascript?

Array of structs in Ruby
3448 [jilanik@ti .] How to translate this C code in Ruby.
3450 [matz@ne la .] class Person
3452 [jilanik@ti .] Thanks a lot matz ;-)
3458 [matz@ne la .] persons = []
3465 [aleksi.nieme] While Matz's answer is quite good one to one translation of the original

a Delphi/Pascal variant - Why not?
3449 [jilanik@ti .] Wonderful! I think you can start from Free Pascal. It is already free and open

chomp, strings
3454 [matju@CA .O ] btw, perl does copy-on-write, which eliminates most of the overhead of

Errors missing in Library reference?
3461 [feldt@ce ch ] I can't seem to find the errors (StandardError and it's subclasses) in the
3462 [andy@To ls e] They're in a section in another part of the book. The system errors

Array of objects
3466 [aleksi.nieme] how about adding a new Array.new version

[Ron Jeffries <ronjeffries@acm.org>] Re: [XP] What's wrong with strict typing?
3468 [Dave@th ma e] Folks - the following message was posted by Ron Jeffries on the
3471 [charleshixsn] That's one of the bottom lines.  Static typing

Installing Ruby using Windows 98
3484 [wforbes@th r] I haven't had any luck getting Ruby up and running using Windows 98.
3488 [aleksi.nieme] You're probably just providing all the information what exactly you've tried
+ 3490 [wforbes@th r] Thanks for the information. All I have tried is the automatic setup ruby140.exe
+ 3510 [wforbes@th r] Thanks again. I have installed rbdj144. I works sometimes, and sometimes

Re: Python 3000 -> No, but there's 'Ruby'
3486 [aahz@ne co .] [x-posted to comp.lang.ruby, followups to comp.lang.ruby]

Ruby to call commands, e.g. "find , perl scripts , nmap , and others" is  thispossible?
3493 [jovecka@da l] Dear list,
3494 [Dave@th ma e] You have several options.
3504 [jovecka@da l] I am trying to use nmap to test my own network and automate the process.
3506 [Dave@th ma e] I don't want to get into a Ruby vs. Perl discussion, but I can offer

RUBY NEWSGROUP FAQ -- Welcome to comp.lang.ruby!
3496 [schneiker@ju] RUBY NEWSGROUP FAQ -- Welcome to comp.lang.ruby!

Re: Nominally frozen classes (was Static Typing (was ...))
3499 [schneiker@ju] "Frank Mitchell" writes,
3501 [Dave@th ma e] But ho could that work in practice? My code uses your code.  One day,

Re: Python 3000 -> No, but there's 'R***'
3500 [schneiker@ju] Likewise.
+ 3505 [aahz@ne co .] [posting this just to comp.lang.ruby; it's really not relevant to
| 3507 [aleksi.nieme] I appreciate a lot what Conrad has been doing but I have to say the subject
| 3514 [c.hintze@gm ] very nice article, indeed. I wholeheartly agree with you on all its
+ 3508 [schneiker@ju] "Shae Erisson" writes

[1.5] Class variable
3503 [decoux@mo lo] 1) I can modify a class variable (with $SAFE >= 4) but not an instance
3511 [matz@ne la .] 1) No.  It's a bug.  I should have add check for class variable

Security Problems
3513 [jilanik@ti .] I have written a little web application with Ruby; I have put HTML files

Options database (was: Define & Include?)
3515 [claird@st rb] It's worse than that--all we've seen in *any* of the books
3535 [schneik@au t] (Cameron: Thanks for the info.)
3567 [claird@st rb] You're welcome.

Deep copy?
3516 [hgs@dm .a .u] Given that I cannot overload =, how should I go about ensuring a deep
+ 3518 [gotoken@ma h] I think there isn't general way. The meaning of deep copy depends on
| + 3520 [hgs@dm .a .u] OK.  I can live with that I suppose.
| | 3523 [Dave@th ma e] Or objects such as descendants of IO that hold external resources that
| + 3521 [gotoken@ma h] Appologies for my Engurish :-(
+ 3519 [Dave@Th ma e] Would marshaling do what you need?
| 3522 [hgs@dm .a .u] Probably, but it would be slow.  I think it is interesting that deep copy
| 3524 [gotoken@ma h] A serious problem is the meaning of copy.  More precisely, we don't
| 3528 [charleshixsn] ...
| 3551 [hgs@dm .a .u] Thank you for all the input on this.  Yes, open files and other hardware
+ 3525 [schneik@au t] For the general education of other readers (e.g. myself), could someone
| 3527 [Dave@Th ma e] The Smalltalk implementation is typical. We assume a protocol (in the
+ 3534 [matz@ne la .] There's no independent way to copy deeply.  Only way I can think of

$: is broken
3526 [Dave@th ma e] On 1.36, line 569 of configure.in was changed from

ANNOUNCE: depends
3529 [hipster@xs a] `depends' shows forward/reverse package dependencies on a Debian

Ruby users in Japan
3530 [Dave@th ma e] We have heard the rumor that more people use Ruby than Python in
+ 3533 [gotoken@ma h] Sorry, I don't know how we can measure that.  ruby-list is really more
| 3539 [maki@in c. o] In DDJ Japanese edition, there was a serialization about Python.
+ 3540 [maki@in c. o] In FreeBSD-users-ja Mailing list, `FreeBSD ports national census'

Ruby classes and inheritance
3531 [hal9000@hy e] Pardon me for referring to other languages
3537 [matz@ne la .] Since Ruby is a dynamic typed language, you don't NEED pure virtual
3538 [Dave@th ma e] I agree that you probably don't need it--in fact, overcoming the
3556 [nakahiro@sa ] It is very fun.  I used to consider how can I show the interface of
3562 [matz@ne la .] You seem to use 1.4.x, right?
3572 [nahi@ke na t] I checked if that script works on both 1.4.4(2000-04-14) and
3573 [matz@ne la .] It works.  It's fine.  But it's not REQUIRED for 1.5 or later,

Extension in C++?
3532 [feldt@ce ch ] Extending Ruby in C is simple and pretty straightforward. I'm considering
3536 [matz@ne la .] There's no difference between C and C++ in writing extension, except
+ 3558 [feldt@ce ch ] When I make the file below gcc won't compile it since ANSI C++ does not
| 3560 [ttate@ja st ] How about casting the type of the function
+ 3559 [decoux@mo lo] pigeon% cat tt.cc
  3563 [feldt@ce ch ] Thanks a lot.

function objects?
3541 [johann@ph si] I know very little about Ruby, so forgive me if I'm asking something
+ 3542 [matz@ne la .] Yes, it's true.  Instead, Ruby has Procs (aka closure) and
+ 3543 [Dave@Th ma e] Yes and no. A method is not an object per se, but it's easy to make a
| 3545 [johann@ph si] First off, I appreciate the quick reply, both from you and matz.
| + 3546 [matz@ne la .] Because I choose `obj.method' as alias of `obj.method()'.
| | 3564 [johann@ph si] Ah, thanks.  That makes sense.
| | 3571 [matz@ne la .] That's simple story.  The languages return method object with `obj.m',
| + 3548 [Dave@th ma e] Yes - you can invoke both using .call
| + 3550 [decoux@mo lo] In some case, you need `()' to distinguish a kDO2 from a kDO, for example
+ 3554 [gotoken@ma h] This message is off topic, perhaps.  Consider as FYI :-)

A small quiz
3544 [Dave@th ma e] Andy and I were surprised by a Ruby feature. If you'd like, answer the
+ 3547 [matz@ne la .] You mean `"hi"[2,1]', right?
| + 3549 [Dave@th ma e] Thanks for not giving it away ;-)
| + 3585 [hal9000@hy e] I am somewhat mystified by why this should be considered
|   3587 [Dave@Th ma e] Yup - we actually came across this while writing the unit tests to
|   3611 [matz@ne la .] (a) gain and loss are clarified.
|   3613 [Dave@th ma e] Well, the PLS would suggest that str[n] should return nil when
+ 3552 [hgs@dm .a .u] I did not expect that result.  I was more surprised when I used
+ 3553 [hgs@dm .a .u] a = "hi"
+ 3557 [embed@NO PA ] Uh, it's the difference between p a[0] and p a[0,1] that surprises me.

RE:  Selling Rubies by the Carat with magnifying glass
3561 [aleksi.nieme] I don't want to spoil all the fun but I think this is essential part of the

www.ruby-lang.org/en/links.html, etc.
3565 [schneik@au t] Communications
3566 [gotoken@ma h] I've done.  Those changes will be reflected after the next cron execution.

There's a problem with dev.rubycentral.com
3569 [Dave@th ma e] Just to let you all know that there seems to be a problem with

3580 [Dave@th ma e] dev.rubycentral.com appears to be back.

Interface polymorphism
3588 [hal9000@hy e] Another question, guys.
+ 3589 [aleksi.nieme] My guess is that saying
+ 3591 [Dave@th ma e] Whenever you include a module, Ruby effectively[1] inserts that module as
| 3600 [hal9000@hy e] Thanks, Aleksi, and thanks, Dave.
| + 3601 [aleksi.nieme] I've given some thought to this too and my conclusion, so far, has been to
| + 3603 [Dave@th ma e] To be honest with you, I only really started to understood it after I
|   3604 [aleksi.nieme] Or maybe he should suggest :). What do you guys think, would it be step to
|   3605 [Dave@th ma e] My personal vote is 'no', or at least not right now.
+ 3608 [matz@ne la .] Well, Mix-in is not a "interface polymorphism", it's a variation of
  + 3614 [nahi@ke na t] I have been surprised with this behavior.  I did not know well
  | 3615 [nahi@ke na t] Are you defining the interface which IMPLEMENTs another interface?
  + 3641 [hal9000@hy e] Thank you, Matz... see below.
    3642 [matz@ne la .] Well, if you like, you can say that Ruby has restricted MI.  But I'd

Another small quiz
3594 [thucdat@ho m] def fact(n)
+ 3595 [aleksi.nieme] I can't see any problem here. We're calculating factorial in a normal
+ 3596 [gotoken@ma h] Is needed a test for negative number?
| 3597 [thucdat@ho m] Nothing is wrong.
| + 3598 [aleksi.nieme] It gets slower naturally, and should exhibit linear decease of performance,
| + 3599 [gotoken@ma h] The avobe fails fact(0) and fact(1) ;-)
| | 3602 [thucdat@ho m] Really?
| | 3606 [gotoken@ma h] You are right.  Maybe, I tried other code :-(
| + 3666 [matju@CA .O ] It is usually assumed that an addition is O(1) time and a multiplication
+ 3665 [matju@CA .O ] The function is defined on natural numbers (0 and its successors). If this

Is there a statistician in the house?
3607 [Dave@th ma e] I'm looking for a couple of unit tests for Ruby's random number
3609 [decoux@mo lo] ruby use the generator of the system (rand48() or rand()), these
+ 3610 [Dave@th ma e] I know, but... I still need to test that it's manipulating the results
+ 3612 [decoux@mo lo] It's useless  to test when the generator is bad (i.e. I hate

Re: A small quiz -- str[n] vs str[n,1] nearing resolution?
3616 [schneiker@ju] That is good news.
3618 [matz@ne la .] OK, checked in.  Let's see how it goes.

Re: Is there a statistician in the house? -- There's always a chance in the mansion of Ruby....
3619 [schneiker@ju] I think that brand of vodka is good enough for most practical purposes. :-)
3620 [decoux@mo lo] pigeon% cat b.rb
3873 [andy@To ls e] I'll bite.  I've been thinking about writing a better automatic-DJ for

Information -- Please --
3621 [jilanik@ti .] I have been playing with Ruby this last month, and I am impressed by its
3628 [matz@ne la .] Here I am.
3630 [jilanik@ti .] All right. I stay with Ruby. Thank you indeed.

Manual patchlet.
3622 [hgs@dm .a .u] May I suggest the following tiny patch, on the basis that it is more
3627 [matz@ne la .] Well, thank you.

Problem running cvs.
3623 [schneik@au t] Per instructions in the ruby-1.4.4/README, I've tried doing the
+ 3624 [decoux@mo lo] No, it work with 1.9.29
+ 3629 [matz@ne la .] I don't think so.  Mine is 1.10.8.  Routing problem?

Ruby/Tk build problem on AIX solved (was Re: Options database (was:  Define & Include?))
3625 [schneik@au t] The problem is that the ld command line shown below lacks the "-brtl" option.

Ruby/tk problem in Windows
3626 [josesanch@me] I'm use Ruby 1.4.4 for windows and i get a error when i tray to use Tk module.

Ruby 1.4.5
3631 [matz@ev ne l] md5sum is

Ruby 1.4.5
3632 [matz@ne la .] md5sum is
+ 3633 [jilanik@ti .] Sure matz! But what are the fixes and adds?
| 3634 [fit0298@fi e] Many fixes and adds(?) are written in "ChangeLog".
| 3636 [thucdat@ho m] What are my troubles?
| + 3638 [matz@ne la .] 1) Time#local does not generate localtime.
| + 3639 [schneik@au t] <rest of output snipped>
|   + 3640 [schneik@au t] And with the xlC compiler on AIX 4.3, everything ultimately worked fine too.
|   + 3643 [matz@ne la .] Thank you for the success report.
|     3644 [schneik@us i] # In message "[ruby-talk:03639] Re: Ruby 1.4.5"
+ 3637 [matz@ne la .] Sorry, several non trivial bugs are found.  I'll fix them and release