Talk:General FizzBuzz

From Rosetta Code
Revision as of 18:34, 8 November 2018 by Hout (talk | contribs) (JS ES6 :: avoiding a newly introduced run-time error)

20

20 needs explaining in the task description I think --Paddy3118 (talk) 11:41, 8 March 2015 (UTC)

JS ES6 - avoiding a newly-introduced run-time error

Hi MartinBRosenberg I appreciate your taking an interest in my JS ES6 rules based version. I do like some of your edits, thank you !

However:

  1. 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.
  2. 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: [[1]] Hout (talk) 18:34, 8 November 2018 (UTC)