"Marek Janukowicz" <childNOSPAM / t17.ds.pwr.wroc.pl> schrieb im Newsbeitrag
news:slrncai5v9.5f6.childNOSPAM / child.ha.pwr.wroc.pl...
> On Mon, 17 May 2004 16:50:19 +0200, Robert Klemme wrote:
> >> Broken record time:
> >>
> >> The problem with all of these solutions is that they are discovered at
> >> run-time.  I find it increasingly irritating when I have to debug
> >> typing errors by running an application that takes some time to get to
> >> the error.  Enough of those times, the error is a typing error, so that
> >> I've been harping lately about wanting a duck-type checker hooked in to
> >> "ruby -c".
> >
> > I guess due to the nature of Ruby it's impossible to check this without
> > actually executing the code because of Ruby's dynamic typing.
> >
> > If you want compile time type safety you need to use a statically typed
> > language.  Both types of programming languages have their pros and
cons -
> > but you can't get both at the same time.
>
> What about Objective-C? It has static typing (with regular pointers) and
> kind of dynamic typing ("id" type). Maybe Ruby should have similar
> capability? Or maybe I just told something really stupid?

I alway have to look up definitions...
http://en.wikipedia.org/wiki/Dynamic_typing#Static_vs._dynamic_type_checking

Unfortunately I'm not familiar with Objective C so I can't judge on that.
From what I've seen so far I'd assume it's similar to Java which is regarded
as statically typed although you have access to type information at runtime
(as seems to be the case with Objective C).  But the crucial part is that
you declare types (of variables, of method arguments) in code and these
types are checked by the compiler.

Ruby does not do this (as does Lisp, although it seems there are some
optimization type hints).  So without these declarations it's difficult to
do type verification at compile time without code execution.  To introduce
this wuold be a major change in the language and break lots of code.  If you
would allow for typeless and typed method arguments at the same time, you
would increase interpreter complexity by orders of magnitude and code would
be a real mess.  I don't think, it's a good idea.

Kind regards

    robert