Talk:First-class functions: Difference between revisions

Line 90:
== just changed the Javascript example ==
 
Hello, I changed the Javascript example (http://rosettacode.org/mw/index.php?title=First-class_functions&diff=97198&oldid=97008 ) because I think the old one is totally bogus - no semicolons, no "function" keyword, local var "fn" unintentionally overrides the "fn" array; doesn't work anywhere I tried (Firefox and jsdb). Is this perhaps some dialect I don't know of? UPD hmmm, just found out that jsdb uses the same Javascript engine as Firefox, namely SpiderMonkey... but anyway, my point stands:)[[Special:Contributions/92.226.26.38|92.226.26.38]] 16:28, 12 December 2010 (UTC)
 
:Looking at the older version: it needed the keyword 'function' in front of the definitions for compose and test. Also, 'print' did not do anything useful there, and a different mechanism should have been used. And, you are right that the scope rules conflict with the two instances of 'fn'. However, semicolons are not necessary in javascript since the language requires that line-ends be allowed to terminate statements, so that part was ok. --[[User:Rdm|Rdm]] 19:16, 11 December 2010 (UTC)
Anonymous user