Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news-peer.in.tum.de!news.csl-gmbh.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <1538954.egObkdgl4n@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 18 Oct 2012 11:57:29 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 40 NNTP-Posting-Date: 18 Oct 2012 11:57:30 CEST NNTP-Posting-Host: 6a023df0.newsspool2.arcor-online.net X-Trace: DXC=VITD^9;SdO^U6b:FjPaGjQA9EHlD;3YcR4Fo<]lROoRQ8kFKP2;Jo[T\CQbU>gKiA85d9C^ X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:16705 Patricia Shanahan wrote: > I've just started writing some of my production code, as distinct from > throw-away tests and practice programs. I find myself writing in a style > that would work in a strongly typed language. I know the intended type > of each identifier, and find myself recording types in comments. Good idea. Consider using (some variant of) JSdoc (until something better comes along). > It is perhaps natural because I have been programming so long in > more strongly typed languages. > > Is it a problem? With that "much" information, I have to say yes. > On the one hand, it makes for very organized code, with a lot of > opportunities for adding type-checking assertions, generally a good > thing. On the other hand, I may be missing out on opportunities to make > my code simpler and a better fit for the language. > > Is it enough to be aware of the dynamic aspects of the language, and be > prepared to use them when strong typing gets in the way? (see above) No. (However, contrary to common misconception, there are no "untyped variables". Implementations of ECMAScript Ed. 1 to 3, 5, and 5.1 are dynamically and weakly typed, not untyped. Uninitialized variables and trailing parameters for which no argument has been passed, hold the `undefined' value, the sole value of the Undefined type.) PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs,