Talk:General FizzBuzz: Difference between revisions

m
(JS ES6 :: avoiding a newly introduced run-time error)
Line 7:
 
However:
# '''SyntaxError: Can't create duplicate variable: 'defaultRules'''' on second run is (in all typical JS interpreter embeddings – browsers etc) the result of your removal of the outer module bracketing, If we paste your modified code in the console of a browser, it will run the first time, but if we then repeat, the only result is an error, because you are now defining constants in the global namespace of a persistent JS interpreter instance. Apart from the perennial need to abate global namespace pollution, there is the more pressing problem that a 'const' name can not be assigned twice.
# You will find a few hundred JS examples which I have contributed here, using the Haskell name '''enumFromTo''' for ''integer enumerations'' – the semantics of which does differ from the Python pragmatic convention, but is very far from denotationally 'incorrect' as you suggest. (The Haskell tradition is rather rigorous about denotational semantics, and the use of 'through' vs 'to' in that English sense is more familiar to US than to UK (including Oxford and Glasgow) usage. See, for example, the Haskell documentation of enumFromTo: [[http://hackage.haskell.org/package/base-4.12.0.0/docs/Prelude.html#v:enumFromTo|enumFromTo]] [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 18:34, 8 November 2018 (UTC)
9,655

edits