On 2012-09-04 15:59, Steven Schveighoffer wrote:

I have on occasion had the benefit of simply adding a member variable to
instances of a class when I needed it without having to burden the rest
of the code with knowing about that variable.  I felt dirty doing it...

But I think you are right -- "fake" static typing does not come close to
actual static typing.  If I could count all the time I've wasted because
I mistyped a member variable name, and it "just worked", blissfully
reading null instead of the variable I've set, it would probably add up
to days.  Thankfully, netbeans 7 is better at telling me that a variable
is previously unset or is never used, but it can't be perfect,
especially with this mess I inherited.  The original author thought
"modularity" meant importing large pieces of functions from other files,
which the IDE refuses to correctly interpret.

This, of course, all comes from two guys who really like static typing
:)  We *may* have a biased view.

I can tell you this, I've wished many times that I had static typing in Ruby. I've also wished quite many times I had dynamic typing in D. I think optional static typing, like Dart, sounds like a good idea.

I'm currently updating a Rails project to Ruby 1.9 and I really wished I had static typing. Just that fact that it won't load file until it's actually needed is quite annoying. Finding all the corner cases can be quite a lot of work. For example, a partial that is loaded when the rendering is triggered by an Ajax request.

In any case, it is what it is -- the existing code-base is huge, and I
have no real desire to rewrite all of it :)  The best I can do is add
some typing comments and hobble through it (cursing as I go).  If I had
a year of spare time, I could rewrite it all in D!

-Steve


--
/Jacob Carlborg

Reply via email to