Prototype is heavily based on ideas borrowed from Ruby (which has
many similarities to JavaScript), and thus relies on the idea of
DuckTyping.
See http://wiki.rubygarden.org/Ruby/page/show/DuckTyping for some
info about this.
To address the issue of stuff-that-could-go-wrong-more-easily (as
compared to statc typing) Ruby programmers usually heavily rely on
unit testing (a test to code ration of 1:1 or higher is normal).
You'll find a clone of Ruby's unit test framework (http://www.ruby-
doc.org/stdlib/libdoc/test/unit/rdoc/) in the script.aculo.us
distribution.
Of course, neither approach is right or wrong. In my experience the
time you safe by using a dynamic language compared to static typing
easily allows for implementing lots of unit tests (which can do much
more than just checking for types), plus your final code is less
cluttered and more readable.
Best,
-Thomas
Am 29.07.2006 um 19:06 schrieb Em Te:
I agree that the dynamic typing nature of Javascript is what makes
it useful and suitable for certain tasks. I also agree that not
everyone will benefit from type verification as most webpages are
simple and Javascript only serves as a complementary technology
(like autocomplete) where type verification may be an unnecessary
restriction. But with large-scale AJAX applications where code
complexity is inevitable and where many parts of the webpage are
generated and driven with Javascript, it is precisely this dynamic
typing nature which makes debugging harder, and where type
verification would be beneficial.
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs