Daniel Berger
12/10/2005 4:46:00 PM
robertj wrote:
> >The *real* question is where to get a type-system that is flexible
> >enough to analyze non-runtime dynamic parts of Ruby without spraying
> >class names all over. :-)
>
> that is certainly a point of view that many "typed" guys
> would subscribe to.
> the problem imo is not to define a "sound" typesystem
> (as most static typing systems try to do and fail
> regardless of the imense effort that has been put into)
> but one that helps to define contracts on the borders of your
> system without being restricting on the rest of the system.
>
> the only language i know that did an excellent job on that
> was VB (classic) where you could work mostly untyped
> (if you wanted and you did not care bout performace).
> whenever you wanted to release a COM-object you had
> to define the types.
> this was a very pragmatic approach.
>
> ciao robertj
Evan Webb mentioned that it would be possible to add a pseudo type
system via Behaviors. He may even have a working implementation for
Sydney, but I'll have to double check. It would look something like
this:
# pseudocode
require "behavior/strongtyping"
def foo(String x, y)
end
In this example, x must be a String, while y can be anything. In
effect, optional typing.
I'm actually not sure if I want this, though. I know I've supported it
in the past, but I worry that Java/C/C++ programmers coming to Ruby,
fearing the removal of the static typing training wheels, might adhere
to this style too readily when it should only be used sparingly.
Regards,
Dan