First, please don't call a dynamically typed language "weakly typed".
All the languages we are talking about here: python, ruby, groovy,
perl are STRONGLY typed. They are just dynamically typed, not
statically typed. http://en.wikipedia.org/wiki/Dynamic_type
IMO many of the perceived advantages of dynamic typing have nothing to
do with dynamic typing - it's a result of language design.
There is no reason this code can't be statically typed:
blah = ["this", "argh", "do'h", "world", "hello"]
blah << "another"
blah.join(" ").sort()
println(blah)
>> another argh do'h hello this world
It's obviously an array of string, which can be inferred.
The java equivalent would suck in comparison.
I am watching Charles Nutter's work on Duby, which is a statically
typed Ruby on the JVM. Really cool stuff IMO. http://github.com/headius/duby
& http://blog.headius.com
It's statically typed, but he is adding in optional dynamic typing.
I think having an option for dynamic typing is hugely powerful. I
would just prefer that it's not my ONLY option. Most of the time
static typing is great and makes me more productive. However, there
are cases in which dynamic typing is very handy:
In Ruby's Active Record -
user = User.findByName("phil")
println "user = #{user.name} : #{user.location}"
>> user = phil : denver, co
this does a query "select * from user where name = 'phil'"
so "findByName" is a dynamic method and the user model creates/methods
based on the result set (user.id, user.name). Powerful stuff!
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.