Live data from Hacker News

Loren Segal: Too Lazy to "Type"

gnuu.org

1–10 of 36 posts

Re: Loren Segal: Too Lazy to "Type"

#2
The point of the article is that virtually all real Ruby programs could be transformed, after the fact, into statically typed programs.

The significant point missed is that I can start typing the program without having figured out what the types will be. After the fact you can do the translation, but postponing having to work out not immediately relevant details is huge for developers.

Re: Loren Segal: Too Lazy to "Type"

#3
As a heavy user of statically typed languages who is learning JS and Scala currently, can anyone with more experience with dynamically typed languages confirm or deny the point of the article. Scala, with it's type inferencing seems like it might be a happy medium between. Thoughts anyone?

Re: Loren Segal: Too Lazy to "Type"

#5
> Another fairly interesting paper titled "Evaluating the dynamic behaviour of Python applications", shows that programs in dynamic languages with these runtime modification behaviours often stop modifying their behaviour after a certain amount of "load time".

I find that deeply reassuring, since that's the core idea behind Magpie, the language I'm working on. It's a dynamic language with a static type-checker. The idea is that it runs dynamically at load time so you can imperatively and dynamically build your types and then after that, it statically checks the results, then invokes main() and (presumably) runs in a more or less static fashion after that.

Re: Loren Segal: Too Lazy to "Type"

#6

As a heavy user of statically typed languages who is learning JS and Scala currently, can anyone with more experience with dynamically typed languages confirm or deny the point of the article. Scala, with it's type inferencing seems like it might be a happy medium between. Thoughts anyone?

Type inference is nice and goes a long way, but it's still fundamentally different from being able to modify types imperatively at load time. For example, in Ruby, it's trivial to swap out a method with a version that does some logging, but only on Tuesdays. Scala can't really do that because it presumes all types are locked down before any code (such as code to tell if today is Tuesday) has executed.

Re: Loren Segal: Too Lazy to "Type"

#7
post #2

The point of the article is that virtually all real Ruby programs could be transformed, after the fact, into statically typed programs. The significant point missed is that I can start typing the program without having figured out what the types will be. After the fact you can do the translation, but postponing having to work out not immediately relevant details is huge for developers.

Depends which developers you're talking about. For the developers writing the code in question? Sure. For the developers trying to use that code? ...well, you're going to have to tell them about the types, or hope they can read your code-- the latter isn't really a win at all.

Re: Loren Segal: Too Lazy to "Type"

#8

As a heavy user of statically typed languages who is learning JS and Scala currently, can anyone with more experience with dynamically typed languages confirm or deny the point of the article. Scala, with it's type inferencing seems like it might be a happy medium between. Thoughts anyone?

Type inference is nice and goes a long way, but it's still fundamentally different from being able to modify types imperatively at load time. For example, in Ruby, it's trivial to swap out a method with a version that does some logging, but only on Tuesdays. Scala can't really do that because it presumes all types are locked down before any code (such as code to tell if today is Tuesday) has executed.

One of the points in the article is that this kind of behaviour modification is not done that often. Yea, it happens... but not as much as you'd think.

Re: Loren Segal: Too Lazy to "Type"

#9
post #4

I wonder what the performance benefit of adding optional type hints to ruby or python would be.

Read the Starkiller dissertaion (for Python): http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90....

The compiler gives enormous optimizations for certain (admittedly extremely specialized) numerically intensive programs / calculations. Of course, if the compiler was developed further (it might be, actually), you'd probably see optimizations for larger sets of programs.

Re: Loren Segal: Too Lazy to "Type"

#10
post #8

Earlier quoted context omitted.

Type inference is nice and goes a long way, but it's still fundamentally different from being able to modify types imperatively at load time. For example, in Ruby, it's trivial to swap out a method with a version that does some logging, but only on Tuesdays. Scala can't really do that because it presumes all types are locked down before any code (such as code to tell if today is Tuesday) has executed.

One of the points in the article is that this kind of behaviour modification is not done that often. Yea, it happens... but not as much as you'd think.

I don't think you have that right. I read it as that kind of behavior modification isn't done that often after load time. During load time, all sorts of shenanigans are going on (monkey patching, etc.)
Post reply on HN