From: Ryan Pavlik Date: 2003-04-13T01:15:46+09:00 Subject: Re: Does dynamic typing make it easier to place an object in a container? On Sat, 12 Apr 2003 22:40:22 +0900 wrote: > Ryan Pavlik [mailto:rpav@nwlink.com] wrote: > > > This message has gone on far too long already, but I'll address the > > question in the subject line shortly. With OOP, as you can refer to > > an object by a generic parent class, it's really no more difficult > > in a static language to make a container than in a dynamic one. > > Either way you can filter your classes to make homogenous containers, > > or allow heterogenous containers. > > Ahem. I beg to (gently) differ. I program in Ruby and in Java on a > regular basis, and it is much more difficult to use containers in Java > than it is in Ruby. For example: Oh, I'd have to agree here. I was actually referring to implementation, which is what I thought the original question was about. (That is, implementing a generic container in a static language isn't really significantly harder.) Usage is a whole different issue. And Java is another. ;-) > Of course, I could always implement my own, smart Collection in Java, > right? Sure, and implement 20 methods I don't give a rip about. I guess > my point is that in theory you can say "it's really no more difficult in > a static language to make a container than in a dynamic one," but it > sure does seem a lot harder in practice. Sure, Eclipse will generate > most of that code for me, but I think if you took out the generated > stuff, it'd still be more than the equivalent Ruby code. Again, I guess we're looking at the word "make" in a different light. Generic containers in C++ don't require class-specific functions, but you still have to do a bit of casting. That's always required... it's a static language. But actually writing the container class is basically identical. > On the confusion between dynamic vs. static and weak vs. strong typing, > I agree that it's easy to get them confused. As I was thinking about it, > I remembered something about the word dynamic, though: French dynamique, > from Greek dunamikos, powerful, from dunamis, power, from dunasthai, to > be able. So when you think of Ruby, think of Strong and Powerful. I like that. :-) > Of course, that led me to wonder about the root of static... New Latin > staticus, relating to weight, from Greek statikos, causing to stand, > from statos, standing. So one might think of Java and C++ as being > Strongly Stuck in the Mud from their own Weight ;-). I like that too. >;-) -- Ryan Pavlik "My plans are *always* practical! It's the laws of physics that get in the way of my success." - 8BT