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.
What's that quote? Something like:
"Show me your algorithm and I will remain puzzled, but show me your data structure and I will be enlightened."
To often, I think we're focused on the writing of code rather than the reading of code. Annotations sometimes seem repetitive, but repetitive can aid the readability.
Type inference might be a very nice compromise. Haskell allows you to annotate with type information, and that may provide more helpful errors, but usually it's optional. But people do it anyway, because type information tells a reader so much about the program.
If we just focus on writing, then clearly the programming language is meant only for unidirectional communication from a human to a computer. But if we focus on reading as well, then it becomes about humans communicating with other humans.
I see your point, but dynamic typing is not the only way to get (most of) these benefits, and both of the above show significant performance boosts.
With a little bit of type propagation i think it would lead to quite a natural style of programming.
C#/CLR hints towards that from the other side with the dynamic type, but for syntaxic and cultural reasons, it won't be the same thing as a dynamic language allowing you to use types.
Also, Clojure type hinting is not at all optional typing, as it doesn't enforce types at all. It's purely for performance reasons, and i really think is the wrong way to go about things.
If you cannot figure proper types, you won't write proper program. You "fail early".
class Cool
[:ice, :soda, :snow].each do |item|
define_method item do
#some code
end
end
end
There isn't a real reason why that couldn't be pre-processed. I don't know a ton of Java, but the idea of compile-time code generation is appealing. Does anyone know more about this?Boo can do cool things like that though:
http://bamboo.github.com/2010/07/11/boo-meta-programming-fac...
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.
Every year they redo the entire infrastructure trying to do something that doesn't suck. I gave up in 2003 and never looked back. Every time I see the code for a java web project, or talk to java devs about the issues they face I want to throw up in my mouth a little. If the language is so great why is half the code written in XML, if I wanted to write code in XML, I'd use XSL.
I don't use ruby because dynamic coding / dynamic typing is a panacea, I use ruby because most of the infrastructure is designed to do something useful out of the box with no configuration. If I want it to do something more, I configure.
I'd use F#/ASP.NET MVC/nhaml in a heartbeat over ruby/RoR if all the gems and things that make life easy were readily available. I really don't think ruby is that great of a language, but the gems, rails, etc are awesome enough that I'll put up with the things I don't like.
I'd prefer that people in the java mindset who think I'm too lazy to type keep thinking that and keep their mindset away from any API/gem/module/library I use. Please for the love of god keep thinking the reason I don't use java is that I'm too lazy to type.
JSRs, JCPs, reference implementations, TCKs, JDKs, J2EE, J2SE, J2ME, etc, they are wonderful, I'm so jealous. Unfortunately, I'm just too lazy to type to experience all the wonderful benefits of such technology, so you'll have to keep all that wonderful technology all to yourselves and away from my crappy dynamically programmed, eval'd, dynamically typed, slow & bloated code.
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.
For what it's worth, I think run-time data mining has the potential to transform the industry.