[#77662] A bundle of newbie queries — Gawnsoft <xlucid@...>

I've finally overcome my newbie embarrassment enough to post about

14 messages 2003/08/01

[#77707] Re: is rubyforge down ? — "Tom Copeland" <tom@...>

> On Fri, 01 Aug 2003 13:53:05 +0200, Simon Strandgaard wrote:

16 messages 2003/08/01

[#77794] 1.8.0-previewX rb_sys_fail() on socket instead of an Exception. — Kero van Gelder <kero@...>

Hi all,

14 messages 2003/08/02

[#77806] Indentation Style — Nikolai Weibull <lone-star@...>

I've been meaning to ask this for quite some time. Why is and

28 messages 2003/08/02
[#77817] Re: Indentation Style — Thomas Hurst <tom.hurst@...> 2003/08/02

* Nikolai Weibull (lone-star@home.se) wrote:

[#77838] Re: Indentation Style — Seth Kurtzberg <seth@...> 2003/08/02

On Sat, 2 Aug 2003 23:02:08 +0900

[#77840] Re: Indentation Style — Ben Giddings <ben@...> 2003/08/02

On Sat August 2 2003 1:01 pm, Seth Kurtzberg wrote:

[#77888] Lafcadio: An object-relational mapping layer for Ruby — sera@... (Francis Hwang)

Hi everybody,

13 messages 2003/08/03

[#77896] Too bad I've found about Ruby — "wit" <wit7777bezspamu@...>

Hi.

21 messages 2003/08/03

[#77928] Take a Fantasy Cruise with Me! — "Katrina" <katrina@...>

Hi again,

14 messages 2003/08/04

[#77946] ruby 1.8.0 — matz@... (Yukihiro Matsumoto)

Hello,

32 messages 2003/08/04

[#77992] clearing a parameter in Ruby? — Roy Patrick Tan <rtan@...>

Hi,

15 messages 2003/08/04

[#78023] Parrot SMOP benchmark — Harry Ohlsen <harryo@...>

I was just reading Dan Sugalski's slides from RubyConf 2002 and noticed the benchmarks relating to something called "SMOP" at the end of the article.

12 messages 2003/08/04

[#78032] What's New and Shiny in Ruby 1.8.0? — why the lucky stiff <ruby-talk@...>

Since there were a number of requests around for a more detailed

29 messages 2003/08/05
[#78122] Re: What's New and Shiny in Ruby 1.8.0? — Harry Ohlsen <harryo@...> 2003/08/06

why the lucky stiff wrote:

[#78054] Log4r and Ruby 1.8.0 in Singleton problems — David Heinemeier Hansson <david@...>

Somethings rotten...

21 messages 2003/08/05
[#78055] Re: Log4r and Ruby 1.8.0 in Singleton problems — ts <decoux@...> 2003/08/05

>>>>> "D" == David Heinemeier Hansson <david@loudthinking.com> writes:

[#78057] Re: Log4r and Ruby 1.8.0 in Singleton problems — David Heinemeier Hansson <david@...> 2003/08/05

> D> irb(main):001:0> require 'Singleton'

[#78058] Re: Log4r and Ruby 1.8.0 in Singleton problems — ts <decoux@...> 2003/08/05

>>>>> "D" == David Heinemeier Hansson <david@loudthinking.com> writes:

[#78080] Re: Log4r and Ruby 1.8.0 in Singleton problems — Dave Thomas <dave@...> 2003/08/05

ts wrote:

[#78089] format number with comma separators? — Chris Morris <chrismo@...>

I'm brain dead and just trying to get formatted numbers in a task that's

13 messages 2003/08/05

[#78151] Why does Ruby have callcc? — Jim Bob <invalid@...>

I understand, in a woozy sort of way, what callcc does. What I

46 messages 2003/08/06
[#78158] Re: Why does Ruby have callcc? — Harry Ohlsen <harryo@...> 2003/08/06

Jim Bob wrote:

[#78247] Re: Why does Ruby have callcc? — Ben Giddings <ben@...> 2003/08/06

I have been interested in these continuation-thingys for a while now, so now

[#78165] newbie question from a smalltalker — "Adriano Volpones" <adriano.volpones@...>

Dear all,

38 messages 2003/08/06
[#78166] Re: newbie question from a smalltalker — Lyle Johnson <lyle@...> 2003/08/06

Adriano Volpones wrote:

[#78173] Re: newbie question from a smalltalker — Gavin Sinclair <gsinclair@...> 2003/08/06

On Wednesday, August 6, 2003, 11:22:21 PM, Lyle wrote:

[#78251] More on DRB & OpenSSL — "Nathaniel Talbott" <nathaniel@...>

OK, I've tracked down my problem with DRb and OpenSSL a bit more; perhaps

26 messages 2003/08/06
[#78253] Re: More on DRB & OpenSSL — Michael Garriss <mgarriss@...> 2003/08/06

Nathaniel Talbott wrote:

[#78256] Re: More on DRB & OpenSSL — Aredridel <aredridel@...> 2003/08/06

> I've noticed that there is always a strange silence on DRb questions. I=20

[#78265] Re: More on DRB & OpenSSL — Hugh Sasse Staff Elec Eng <hgs@...> 2003/08/06

On Thu, 7 Aug 2003, Aredridel wrote:

[#78270] Re: More on DRB & OpenSSL — "Nathaniel Talbott" <nathaniel@...> 2003/08/06

Hugh Sasse Staff Elec Eng [mailto:hgs@dmu.ac.uk] wrote:

[#78309] Re: More on DRB & OpenSSL — Hugh Sasse Staff Elec Eng <hgs@...> 2003/08/07

On Thu, 7 Aug 2003, Nathaniel Talbott wrote:

[#78274] Re: Why does Ruby have callcc? — Dan Doel <djd15@...>

As for why callcc takes a block (I didn't see this in any of the replies

19 messages 2003/08/07
[#78291] Re: Why does Ruby have callcc? — Ben Giddings <ben@...> 2003/08/07

On Wednesday, August 6, 2003, at 08:32 PM, Dan Doel wrote:

[#78299] Re: Why does Ruby have callcc? — Jim Weirich <jweirich@...> 2003/08/07

On Thu, 2003-08-07 at 00:42, Ben Giddings wrote:

[#78427] Re: Why does Ruby have callcc? — Ben Giddings <ben@...> 2003/08/08

On Thu August 7 2003 3:03 am, Jim Weirich wrote:

[#78282] Re: [Devculture] ruby question - try Python also (fwd) — Pat Eyler <pate@...>

hmmm, this doesn't mesh terribly well with my experience. Anyone else car

13 messages 2003/08/07

[#78328] Elegant solution for a loop-break problem — KONTRA Gergely <kgergely@...>

Hi!

27 messages 2003/08/07

[#78419] Distributing Ruby applications — Daniel Carrera <dcarrera@...>

Hello Rubyists,

19 messages 2003/08/08

[#78487] Re: Ducktype, right? — "Mills Thomas (app1tam)" <app1tam@...>

> -----Original Message-----

20 messages 2003/08/08
[#78502] Re: Ducktype, right? — Dave Thomas <dave@...> 2003/08/08

Mills Thomas (app1tam) wrote:

[#78505] Re: Ducktype, right? — Ben Giddings <ben@...> 2003/08/08

On Fri August 8 2003 1:25 pm, Dave Thomas wrote:

[#78511] Re: Ducktype, right? — Chris Morris <chrismo@...> 2003/08/08

Ben Giddings wrote:

[#78569] Ruby and OOP-design (question of an old "procedural person" ;) — Meino Christian Cramer <mccramer@...>

Hi !

48 messages 2003/08/09
[#78620] Re: Ruby and OOP-design (question of an old "procedural person" ;) — Martin DeMello <martindemello@...> 2003/08/10

Kent Dahl <kentda+news@stud.ntnu.no> wrote:

[#78622] Re: Ruby and OOP-design (question of an old "procedural person" ;) — Dan Doel <djd15@...> 2003/08/10

[#78629] Re: Ruby and OOP-design (question of an old "procedural person" ;) — dblack@... 2003/08/10

Hi --

[#78634] Re: Ruby and OOP-design (question of an old "procedural person" ;) — Dan Doel <djd15@...> 2003/08/10

dblack@superlink.net wrote:

[#78664] rbbr-0.3.1 — Masao Mutoh <mutoh@...>

Hi,

38 messages 2003/08/11
[#78670] Re: [ANN] rbbr-0.3.1 — Brian Candler <B.Candler@...> 2003/08/11

On Mon, Aug 11, 2003 at 10:10:41PM +0900, Masao Mutoh wrote:

[#78672] Re: [ANN] rbbr-0.3.1 — Masao Mutoh <mutoh@...> 2003/08/11

Hi,

[#78674] Re: [ANN] rbbr-0.3.1 — Brian Candler <B.Candler@...> 2003/08/11

On Mon, Aug 11, 2003 at 10:50:56PM +0900, Masao Mutoh wrote:

[#78682] How to build a distributable Solaris binary for Ruby 1.8? — google-venkatp@... (Venkat)

Hello all:

12 messages 2003/08/11

[#78736] Ruby vs Python? — Daniel Carrera <dcarrera@...>

Hi all,

15 messages 2003/08/11

[#78755] NaN and Inifinity — Scott Thompson <easco@...>

If I do something like

22 messages 2003/08/12

[#78810] UTF-8 question — Nikolai Weibull <lone-star@...>

I've finally switched to UTF-8. It's awesome. Now, if I can only find

24 messages 2003/08/12
[#78823] Re: UTF-8 question — matz@... (Yukihiro Matsumoto) 2003/08/12

Hi,

[#78834] Re: UTF-8 question — Nikolai Weibull <lone-star@...> 2003/08/12

* Yukihiro Matsumoto <matz@ruby-lang.org> [Aug, 12 2003 18:10]:

[#78867] Re: UTF-8 question — nobu.nokada@... 2003/08/12

Hi,

[#78813] Nested class/module namespace — "Nathaniel Talbott" <nathaniel@...>

The new ability to declare a class nested in another module (or class)

36 messages 2003/08/12
[#78831] Re: Nested class/module namespace — Kent Dahl <kentda+news@...> 2003/08/12

Nathaniel Talbott wrote:

[#78862] Re: Nested class/module namespace — "Nathaniel Talbott" <nathaniel@...> 2003/08/12

Kent Dahl [mailto:kentda+news@stud.ntnu.no] wrote:

[#78843] Re: Nested class/module namespace — matz@... (Yukihiro Matsumoto) 2003/08/12

Hi,

[#78815] Windows Installer for Ruby 1.8.0 Final — Andrew Hunt <andy@...>

Thanks for your patience

21 messages 2003/08/12

[#78836] AW: [ann] AEditor 0.10, folding added — "Recheis Meinrad" <Meinrad.Recheis@...>

29 messages 2003/08/12
[#78858] Re: AW: [ann] AEditor 0.10, folding added — "Simon Strandgaard" <0bz63fz3m1qt3001@...> 2003/08/12

On Wed, 13 Aug 2003 02:56:48 +0900, Recheis Meinrad wrote:

[#78980] Re: AW: [ann] AEditor 0.10, folding added — Lothar Scholz <mailinglists@...> 2003/08/13

Hello Simon,

[#79002] Refactoring Browsers (was: [ann] AEditor 0.10, folding added) — Jim Weirich <jweirich@...> 2003/08/13

On Wed, 2003-08-13 at 14:03, Lothar Scholz wrote:

[#79009] Re: Refactoring Browsers (was: [ann] AEditor 0.10, folding added) — Richard Kilmer <rich@...> 2003/08/14

A difference between smalltalk and ruby...smalltalk is image based

[#79044] Re: Refactoring Browsers (was: [ann] AEditor 0.10, folding added) — "Its Me" <itsme213@...> 2003/08/14

[#79046] Re: Refactoring Browsers (was: [ann] AEditor 0.10, folding added) — Richard Kilmer <rich@...> 2003/08/14

[#78905] ruby curses documentation ? — MENON Jean-Francois <jean-francois.menon@...>

hello,

12 messages 2003/08/13

[#78961] Java/Ruby communication — Nigel Gilbert <n.gilbert@...>

I am planning to write a Java program and and a Ruby program and have

16 messages 2003/08/13

[#79001] Overloading () — Dan Doel <djd15@...>

Hi,

20 messages 2003/08/13

[#79060] Ruby & Windows-world; IDEs — Armin Roehrl <armin@...>

Hi all,

32 messages 2003/08/14

[#79142] list of Ruby capable text editors? — Martin Pirker <crf@...>

Hi...

25 messages 2003/08/15

[#79192] Newbie Q: Data encapsulation with Ruby — Meino Christian Cramer <mccramer@...>

Hi,

23 messages 2003/08/16
[#79195] Re: Newbie Q: Data encapsulation with Ruby — dblack@... 2003/08/16

Hi --

[#79250] Rite/Ruby2.0 & Ruby vs OCaml — <prosys@...>

Hi All,

53 messages 2003/08/17
[#80116] Re: Rite/Ruby2.0 & Ruby vs OCaml — "Jason Watkins" <jason_watkins@...> 2003/08/25

OCaml is a fine language, but it certainly is not as fun as ruby... unless

[#80142] Re: Rite/Ruby2.0 & Ruby vs OCaml — Brian Candler <B.Candler@...> 2003/08/25

On Mon, Aug 25, 2003 at 02:23:56PM +0900, Jason Watkins wrote:

[#80148] Re: Rite/Ruby2.0 & Ruby vs OCaml — mark <msparshatt@...> 2003/08/25

On Monday 25 Aug 2003 4:10 pm, Brian Candler wrote:

[#79280] Wish: Python-style indenting — Jon_Aquino@... (Jonathan Aquino)

I wish Ruby had Python's use of whitespace to indicate blocks. Then I

17 messages 2003/08/17

[#79283] Bug when rerouting String#gsub with a block using $1? — Florian Gross <flgr@...>

Moin!

11 messages 2003/08/17

[#79292] Ruby for 3D graphics? — "Brandon J. Van Every" <vanevery@3DProgrammer.com>

Ok, I'm sick to death of C++. I'm moving on to a higher level language of

14 messages 2003/08/18

[#79319] Question: immutable strings as design goal? — Gavin Sinclair <gsinclair@...>

-talkers,

15 messages 2003/08/18

[#79337] Re: Question: immutable strings as design goal? — Robert Feldt <feldt@...>

33 messages 2003/08/18
[#79362] Re: Question: immutable strings as design goal? — hanzspam@... (Hannu Kankaanp粐) 2003/08/18

Robert Feldt <feldt@ce.chalmers.se> wrote in message news:<oprt3sncb0oglyup@mail1.telia.com>...

[#79397] Re: Question: immutable strings as design goal? — Gavin Sinclair <gsinclair@...> 2003/08/18

On Tuesday, August 19, 2003, 3:21:32 AM, Hannu wrote:

[#79412] Why did you switch from Python to Ruby? — "Brandon J. Van Every" <vanevery@3DProgrammer.com>

This question is only meant to apply to people who used to use Python, but

174 messages 2003/08/19
[#79492] Why would you abandon Ruby? (was) — "Brandon J. Van Every" <vanevery@3DProgrammer.com> 2003/08/19

Sean O'Dell wrote:

[#79504] Re: Why would you abandon Ruby? (was) — Michael Granger <ged@...> 2003/08/20

On Tuesday, August 19, 2003, at 04:05 PM, Brandon J. Van Every wrote:

[#79517] Re: Why would you abandon Ruby? (was) — "Brandon J. Van Every" <vanevery@3DProgrammer.com> 2003/08/20

Sean O'Dell wrote:

[#79522] Re: Why would you abandon Ruby? (was) — Mark Wilson <mwilson13@...> 2003/08/20

[#79414] $VERBOSE=true returns warnings from standard library — thomass@... (Thomas)

I normally write my ruby code with $VERBOSE=true. When I do this in

11 messages 2003/08/19

[#79433] Re: What's TOTALLY COMPELLING about Ruby over Python? — phlip_cpp@... (Phlip)

> I don't know either. I do know of several posters on the XP

18 messages 2003/08/19
[#79435] Re: What's TOTALLY COMPELLING about Ruby over Python? — "Michael Campbell" <michael_s_campbell@...> 2003/08/19

> If you were to instrument my physical responses and typing rate while

[#79461] Re: What's TOTALLY COMPELLING about Ruby over Python? — "Dave Benjamin" <dave@3dex.com> 2003/08/19

"Michael Campbell" <michael_s_campbell@yahoo.com> wrote in message

[#79462] Re: What's TOTALLY COMPELLING about Ruby over Python? — dblack@... 2003/08/19

Hi --

[#79470] Re: What's TOTALLY COMPELLING about Ruby over Python? — dblack@... 2003/08/19

Hi --

[#79533] What attracts me to Ruby — Ged Byrne <gedb01@...>

As a newbie moving over from Python, the recent posts

24 messages 2003/08/20

[#79655] Punctuation as noise — "Hal E. Fulton" <hal9000@...>

I've been thinking for a day or so about

21 messages 2003/08/20

[#79673] Trollassassin — "Kurt M. Dresner" <kdresner@...>

So, I had this idea, but I couldn't think of anywhere better to post it.

13 messages 2003/08/20

[#79754] Class variables - a surprising result — Jason Williams <jason@...>

class Sup

14 messages 2003/08/21

[#79788] Re: Class variables - a surprising result — "Bennett, Patrick" <Patrick.Bennett@...>

Obviously there's some confusion though Matz.

19 messages 2003/08/21
[#79815] Re: Class variables - a surprising result — matz@... (Yukihiro Matsumoto) 2003/08/21

Hi,

[#79822] Re: Class variables - a surprising result — "Mark J. Reed" <markjreed@...> 2003/08/21

On Fri, Aug 22, 2003 at 03:47:33AM +0900, Yukihiro Matsumoto wrote:

[#79794] Integrated Webserver? — Martin DeMello <martindemello@...>

The HTML form thread made me wonder if we shouldn't have some equivalent

13 messages 2003/08/21

[#79818] Re: How do I handle an HTML form from ruby? — "Mills Thomas (app1tam)" <app1tam@...>

Having Ruby start a browser with the correct form.html file is easy enough.

20 messages 2003/08/21
[#80198] Re: Any sample code where ruby is used in the Eclipse devepment environment? — Ludwigi Beethoven <aix_tech@...> 2003/08/26

Thank you Nathaniel.

[#80269] Re: Any sample code where ruby is used in the Eclipse devepment environment? — gabriele renzi <surrender_it@...1.vip.ukl.yahoo.com> 2003/08/26

il Tue, 26 Aug 2003 22:01:51 +0900, David Corbin

[#80369] Re: Any sample code where ruby is used in the Eclipse devepment environment? — Mauricio Fern疣dez <batsman.geo@...> 2003/08/27

On Wed, Aug 27, 2003 at 04:28:31AM +0900, gabriele renzi wrote:

[#80578] Re: Any sample code where ruby is used in the Eclipse devepment environment? — Ludwigi Beethoven <aix_tech@...> 2003/08/29

I am not sure what the AIX comment is all about, but

[#80586] Re: Any sample code where ruby is used in the Eclipse devepment environment? — Michael Campbell <michael_s_campbell@...> 2003/08/29

--- Ludwigi Beethoven <aix_tech@yahoo.com> wrote:

[#79819] Re: Class variables - a surprising result — "Bennett, Patrick" <Patrick.Bennett@...>

My point was that many programmar's mistake Ruby's 'class' variables as

26 messages 2003/08/21
[#79887] Re: Class variables - a surprising result — matz@... (Yukihiro Matsumoto) 2003/08/22

Hi,

[#79888] Re: Class variables - a surprising result — "Gavin Sinclair" <gsinclair@...> 2003/08/22

> Hi,

[#79890] Re: Class variables - a surprising result — Ryan Pavlik <rpav@...> 2003/08/22

On Fri, 22 Aug 2003 12:32:12 +0900

[#79894] Re: Class variables - a surprising result — Patrick Bennett <patrick.bennett@...> 2003/08/22

Ryan Pavlik wrote:

[#79898] Re: Class variables - a surprising result — Dan Doel <djd15@...> 2003/08/22

Patrick Bennett wrote:

[#79901] Re: Class variables - a surprising result — Patrick Bennett <patrick.bennett@...> 2003/08/22

Dan Doel wrote:

[#79833] Wrapping ENV — "Hal E. Fulton" <hal9000@...>

I just wrote a little piece of code. Is it useful to anyone but

15 messages 2003/08/21

[#79849] POLS and names of mathematical functions — "Josef 'Jupp' Schugt" <jupp@...>

Saluton!

17 messages 2003/08/21

[#79981] Aspect oriented Everything? — letterbox1001@... (New_aspect)

Hello,

37 messages 2003/08/22

[#80038] Ruby & Perl — David Corbin <dcorbin@...>

Has anyone considered some way to make Perl modules callable from Ruby?

20 messages 2003/08/23

[#80135] Specification of Ruby regex? — Ronald Pijnacker <rhp@...>

Hi all,

32 messages 2003/08/25
[#80211] Re: Specification of Ruby regex? — "Tim Hunter" <cyclists@...> 2003/08/26

On Tue, 26 Aug 2003 16:15:38 +0900, Ronald Pijnacker wrote:

[#80212] Re: Specification of Ruby regex? — Emmanuel Touzery <emmanuel.touzery@...> 2003/08/26

Hello!

[#80157] Ruby launching system apps? — "Dan" <falseflyboy@...>

I have a UNIX machine and I want a ruby app that can launch UNIX commands

15 messages 2003/08/25

[#80217] Another Ruby-powered site — Thomas Hurst <tom.hurst@...>

http://qurl.net/ -- a couple of hours with Ruby and FastCGI.

21 messages 2003/08/26
[#80276] Re: Another Ruby-powered site — gabriele renzi <surrender_it@...1.vip.ukl.yahoo.com> 2003/08/26

il Tue, 26 Aug 2003 21:58:21 +0900, Thomas Hurst <tom.hurst@clara.net>

[#80278] Re: Another Ruby-powered site — Michael Campbell <michael_s_campbell@...> 2003/08/26

--- gabriele renzi <surrender_it@rc1.vip.ukl.yahoo.com> wrote:

[#80316] errors compiling Ruby under Solaris — "Kurt M. Dresner" <kdresner@...>

I'm trying to compile Ruby under Solaris. I suck at C, so I don't know

24 messages 2003/08/27
[#80320] Re: errors compiling Ruby under Solaris — nobu.nokada@... 2003/08/27

Hi,

[#80322] Re: errors compiling Ruby under Solaris — nobu.nokada@... 2003/08/27

Hi,

[#80327] Re: errors compiling Ruby under Solaris — "Kurt M. Dresner" <kdresner@...> 2003/08/27

I am using 3.0.3.

[#80331] Re: errors compiling Ruby under Solaris — nobu.nokada@... 2003/08/27

Hi,

[#80345] Re: errors compiling Ruby under Solaris — "Kurt M. Dresner" <kdresner@...> 2003/08/27

> Instead, send ext/socket/mkmf.log.

[#80663] Re: errors compiling Ruby under Solaris — nobu.nokada@... 2003/08/31

Hi,

[#80668] Re: errors compiling Ruby under Solaris — "Kurt M. Dresner" <kdresner@...> 2003/08/31

> What headers do you need to compile sys/socket.h?

[#80670] Re: errors compiling Ruby under Solaris — nobu.nokada@... 2003/08/31

Hi,

[#80672] Re: errors compiling Ruby under Solaris — "Kurt M. Dresner" <kdresner@...> 2003/08/31

It turns out that the thing I sent before was from a Solaris 9 machine,

[#80354] Mac OS X and ruby-postgres again — Thomas Yager-Madden <tym@...>

Hello,

14 messages 2003/08/27
[#80359] Re: Mac OS X and ruby-postgres again — Brian McCallister <mccallister@...> 2003/08/27

How did you install postgresql? I had to specify the location of the

[#80399] os x / mysql : install 1.8 : ruby = nil — paul@... (paul vudmaska)

I'm trying to install ruby/eruby and mysql to learn ruby for web stuff

10 messages 2003/08/27

[#80457] #collect with block modifying receiver — Hal Fulton <hal9000@...>

Hello, all...

13 messages 2003/08/28

[#80497] Python vs. Ruby — Fred <fred@...>

Can anyone give me a good reason why I would want to use Ruby over Python?

53 messages 2003/08/28
[#80507] Re: Python vs. Ruby — dagbrown@... (Dave Brown) 2003/08/28

In article <cxu3b.289101$uu5.63844@sccrnsc04>,

[#80519] Re: Python vs. Ruby — Scott Thompson <easco@...> 2003/08/29

> : Can anyone give me a good reason why I would want to use Ruby over

[#80573] Re: Python vs. Ruby — "W. Kent Starr" <wyzzrd@...> 2003/08/29

Careful, boys,

[#80751] Re: Python vs. Ruby — hanzspam@... (Hannu Kankaanp粐) 2003/09/01

"jbritt@ruby-doc.org" <jbritt@ruby-doc.org> wrote in message news:<3F519252.3090408@ruby-doc.org>...

[#80774] Re: Python vs. Ruby — mark <msparshatt@...> 2003/09/01

On Monday 01 Sep 2003 9:47 am, Hannu Kankaanp粐 wrote:

[#80788] Re: Python vs. Ruby 2003/09/01

mark wrote:

[#80884] Re: Python vs. Ruby — james_b <james_b@...> 2003/09/02

Sean O'Dell wrote:

[#80896] Re: Python vs. Ruby 2003/09/02

james_b wrote:

[#80542] multiply all array with array — ibotty <me@...>

before i spent to many words describing something so simple:

16 messages 2003/08/29

[#80715] `echo %!(*` — Tom Felker <tcfelker@...>

Hello all,

15 messages 2003/08/31

Re: Ducktype, right?

From: Dan Doel <djd15@...>
Date: 2003-08-08 21:10:44 UTC
List: ruby-talk #78529
Someone suggested that the discussion of what duck typing is is getting 
away from how it was originally used.

Perhaps I'm confused, or I'm not explaining what I think in the correct 
way, so I'll try again.

Maybe a better way of phrasing the concepts of duck typing is contract 
typing.

If you look at Java, interfaces more-or-less define contracts between 
objects.  If you have an interface Appendable, that's a contract that 
says an object will

    a) Have a method append()
    b) Implement that in a certain way

a) can be had in Ruby via respond_to?, the use of which isn't required 
for duck typing. b) can be had more explicitly by using modules. 
However, modules, in my mind, are more for reusing code between class 
hierarchies without requiring multiple inheritance, rather than for 
defining what methods an object implements (although they could be used 
for the latter).

If you really want to talk about duck typing, you'd be talking about an 
example along the lines of:

def add_elements(foo)
    foo << "a"
    foo << "b"
end

This method accepts an array (foo) and adds two elements to it using the 
append operator.  However, looked at more abstractly, this method takes 
any object for which << implies append in an array sense.  We could 
actually pass in a binary search tree where << adds an element to the 
three, and it would work in a similar way.  If we pass in a Fixnum where 
<< is bitwise shift, then we've broken the contract.

In Java, you need interfaces for this. You could write:

void addElements(Array foo)
{
    foo.append("a");
    foo.append("b");
}

void addElements(BST foo)
{
    foo.append("a");
    foo.append("b");
}

But it's easier to have both implement Appendable, and have addElements 
work on anything that is Appendable.  Java needs interfaces because of 
static type checking.  In ruby you can just assume that an object 
implements things correctly and use it as such, which, I think, is the 
idea of duck typing.

If you want to make it more general, you can add a respond_to? :<< and 
respond_to? :append, since different objects might implement either or 
both of those.  However, the key idea is that in ruby, the contracts are 
dynamic.  Using Java interfaces, to some degree, forces you to follow 
the contracts more explicitly, since you have to knowingly say you 
implement a contract and continue to break that contract. However, 
assuming that the contract is documented somewhere in the code, and 
everybody follows that contract, then there is no need to explicitly 
define modules or classes just to define the contract in code, rather 
than leaving it in documentation.  If you do define modules for each 
semantic, then you end up with each of your classes including 10 
different modules just so that code can check and see if a class follows 
some contract (look through the Java standard library and you'll see 
many classes like this). You're effectively turning ruby into a 
statically typed language where all the type checking is done by you at 
runtime.

So another way of saying "duck typing" is "programming with implicit 
contracts" or "implicit contract typing" or something like that, rather 
than Java, where implicit is replaced with explicit.  This is really 
something of a feature of any language that isn't statically typed. The 
difference in the case of ruby is that, although you can check the class 
of an object with is_a? (or something like that), there's no way to tell 
from the class itself whether it will satisfy the contract.  You have to 
assume it does.

So having respond_to? :quack doesn't make it a duck. It's also how quack 
is implemented, and there's no way to really check that without 
testing.  Duck typing means making assumptions.

Anyhow, that's my take on it all, at the end of the day. I hope I'm not 
too off base.  If I am, then Dave can yell at me.

- Dan


In This Thread