From: Joao Pedrosa Date: 2005-01-30T03:47:40+09:00 Subject: Re: Ten Things Every Java Programmer Should Know About Ruby Hi, On Sun, 30 Jan 2005 03:22:21 +0900, Navindra Umanee wrote: > Florian Gross wrote: > > Not having your Objects changing types all the time without you > > noticing. If you forget to initialize a field in PHP it will be > > converted to zero or an empty String if necessary thus shadowing your > > bug. Strong typing usually is a requirement for languages where OOP > > works well. > > In Ruby, objects pass for different types all the time. In my own > recent Ruby code I've mistakenly passed in the wrong types but didn't > notice because the types responded to the same methods. > > Even though the type didn't change, effectively the problem and bug > shadowing was identical to the case you describe. Yes, because the type is not checked for most of the operations. Well, we work on high-level objects, not with memory pointers. The high-level objects get created and recreated on demand by the language, so one change in a determined variable won't break the code somewhere else, as it probably is working on a local copy of the object (the data and methods, not the memory pointer.) When objects get "passed by value" it helps a lot the general stability of the system. That's why even in Java you pass by value. Though when you want a bullet proof library, you need extra-work to avoid the user from messing up with the internal code (in Java.) In Ruby, we are freer from the "static typing" checks, and as freedom is something (generally,) good, we have more features which allow us to be freer than with other languages. This article talks about languages and tools: http://osteele.com/archives/2004/11/ides So yeah, we don't have everything that other languages have. It's good or bad depending if you require those features/tools. The problem is that we don't have a definitive answer to whether there is a God, as well as we don't have a definitive answer on whether dynamic languages (that are not Smalltalk) can be as tool enabled as the static typed languages. Maybe not. Can we do ok even without certain tools? Maybe, depending on some factors. Our memory allocated "objects" have strong types, but they aren't enforced on the operations, because we don't add types to our coding, like in Java. If Ruby was to be more like Java, it would lose its "sparkness." If type could be infered and pre-checked, then at least it would be an improvement over Java's approach. And any investment on Ruby should not try to take it over from the community. :-) Cheers, Joao