Talk:First-class functions: Difference between revisions

Line 91:
 
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?
 
: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)
6,962

edits