From: Sean O'Dell Date: 2003-11-20T10:17:36+09:00 Subject: Re: "stereotyping" On Wednesday 19 November 2003 04:22 pm, Eric Schwartz wrote: > "Sean O'Dell" writes: > > On Wednesday 19 November 2003 03:57 pm, Eric Schwartz wrote: > >> It's not a lot better to me, because it's inconsistent. If, as you > >> propose, it should work one way in some cases (the person honors the > >> interface) and not in others (they don't), then you're right back > >> where you started! > > > > That's just how Ruby is, though. When you get an object, you never > > know what you're going to get with it. > > Exactly! And if you sorta-promise something, and you only > sorta-deliver on it, you get more confused than if you *know* you're > promised nothing. > > > It's completely open-ended. This is just one way to clear the air. > > But it doesn't clear the air, it only pretends to, and only in some > cases. But, as with Ruby's dynamic typing, that's good enough. Having strong typing wasn't the boom everyone thought it was. Ruby's success is proof of that. It follows then that an interface declaration system would work the same way. It would just fine, and in those instances where it doesn't, they're exceptions and the developer will just have to deal with it the way we deal with dynamic typing issues now. The interface declaration system is just another way to help them, it's not a guarantee of perfection. > > In exceptional cases like > > half-implemented interfaces, you're going to get the same old errors > > you always got. > > But with Ruby, it's not exceptional to only half-implement interfaces. > In fact, it's probably the default-- with duck typing, you only > implement enough to do the job. I haven't seen enough other code to > know for sure, but I think you're being biased by your C++/Java > background to expect complete interface implementations more often > than no. This is why I feel the worry over half-implemented interfaces is unfounded. This isn't a static typing system, it's just a declaration system. > >> Only it's worse, because now Programmer C sees that B promised to > >> implement interface 'foo', and now she has to figure out where > >> interface 'foo' is defined (probably in Library D, which she may not > >> even have installed) and is even more confused than before. And I > >> speak as someone who is continually irritated by having to troll > >> through, say, cgi.rb or dbi.rb to discover there's a method that does > >> what I want it to. > > > > How does Ruby work right now? Better than that? > > Yes, because at least right now Programmer C won't waste all that time > trying to figure out what 'foo' is, whether or not Library B > implemented all of it, and whether that's even relevant to the problem > at hand. She'll dive right into library C's code and check it out, > which will save her much more time getting to the right answer. To you, it's easier to dig around in someone else's code than simply read an error message? I guess I'm a bit out of touch with that method of development. To me, digging around in the source code comes only when I don't understand what the error message is telling me. > What you're asking for (currently) misses the spirit and attitude of > the language, so it's not surprising that people are reacting badly to > it. You might just as well head over to comp.lang.python and tell > them that any sensible language wouldn't require significant > indentation, and create a PCR (or whatever it's called) to "fix" that. What I think is that so many people have expounded for so long on dynamic typing that it's hard to admit that perhaps there's a benefit to something resembling type checking. Apparently there is too much invested in dynamic typing to compromise. I give up here, if that's the case. I never close my mind to anything, and it seems that most people here are simply closed to the idea of anything resembling type checking. Sean O'Dell