[#5218] Ruby Book Eng tl, ch1 question — Jon Babcock <jon@...>

13 messages 2000/10/02

[#5404] Object.foo, setters and so on — "Hal E. Fulton" <hal9000@...>

OK, here is what I think I know.

14 messages 2000/10/11

[#5425] Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Jon Babcock <jon@...>

18 messages 2000/10/11
[#5427] RE: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — OZAWA -Crouton- Sakuro <crouton@...> 2000/10/11

At Thu, 12 Oct 2000 03:49:46 +0900,

[#5429] Re: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Jon Babcock <jon@...> 2000/10/11

Thanks for the input.

[#5432] Re: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Yasushi Shoji <yashi@...> 2000/10/11

At Thu, 12 Oct 2000 04:53:41 +0900,

[#5516] Re: Some newbye question — ts <decoux@...>

>>>>> "D" == Davide Marchignoli <marchign@di.unipi.it> writes:

80 messages 2000/10/13
[#5531] Re: Some newbye question — matz@... (Yukihiro Matsumoto) 2000/10/14

Hi,

[#5544] Re: Some newbye question — Davide Marchignoli <marchign@...> 2000/10/15

On Sat, 14 Oct 2000, Yukihiro Matsumoto wrote:

[#5576] Re: local variables (nested, in-block, parameters, etc.) — Dave Thomas <Dave@...> 2000/10/16

matz@zetabits.com (Yukihiro Matsumoto) writes:

[#5617] Re: local variables (nested, in-block, parameters, etc.) — "Brian F. Feldman" <green@...> 2000/10/16

Dave Thomas <Dave@thomases.com> wrote:

[#5705] Dynamic languages, SWOT ? — Hugh Sasse Staff Elec Eng <hgs@...>

There has been discussion on this list/group from time to time about

16 messages 2000/10/20
[#5712] Re: Dynamic languages, SWOT ? — Charles Hixson <charleshixsn@...> 2000/10/20

Hugh Sasse Staff Elec Eng wrote:

[#5882] [RFC] Towards a new synchronisation primitive — hipster <hipster@...4all.nl>

Hello fellow rubyists,

21 messages 2000/10/26

[ruby-talk:5719] Re: Dynamic languages, SWOT ?

From: Dave Thomas <Dave@...>
Date: 2000-10-20 19:32:58 UTC
List: ruby-talk #5719
Charles Hixson <charleshixsn@earthlink.net> writes:

> > This is the area I'm thinking about where the typing is not so strong
> > as would ease error detection.  OK, types can be dynamic, but for
> > parameters it only make sense for them to be in a subset of the
> > class heirarchy.   There is no way to express this constraint in Ruby
> 
> This is a run time check in a dynamically bound language.  I'm pretty sure
> that Ruby does have ways to catch this, though they don't seem, to me, to be
> quite as ?elegant?, ?standardized? as those that Smalltalk uses.  Much more
> similar to the techniques of Python.

Well, I'm not sure what Ruby could do here, apart from implementing
protocols. You can't constrain a parameter to be an object of a
particular class: it's the methods that the object supports that is
relevant, not the class itself (as I know everyone knows--I'm just
reemphasizing the point)

So,

   def append(to, what)
     to << what
   end

works equally well when passed a File, and Array, or a String as it's
first parameter.

Objective C had the concept of protocols, which are similar to Java's
interfaces, which specified what messages an object supports.  This
_could_ be added to Ruby (I have a quick hack that implements them in
Ruby itself).

However, let me ask a question: how often do you get bitten by this in 
reality? And, having been bitten, how long does it take to fix?

Personally, I find that I pass in a wrong object about once in a blue
moon, and it becomes apparent that I goofed pretty quickly.

Now ask yourself a different question. Right now, legions of Java
programmers are using

   Employee emp = (Employee)staff.nextElement();

Fundamentally, how is this different from using Ruby's type system?


Regards

Dave


In This Thread