Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • Actually, ECMAScript has very powerful code organization support with functions. Since functions can nest, you can group functions in functions. That's all you need, as is evidenced by the fact that both ES2015 classes and modules are just simple syntactic sugar over functions. Never underestimate the power of nesting, see Beta's nested classes, which are used to perfection in Newspeak, nested functions in Scheme (which are used to implement pretty much everything from modules to objects to classes), etc. If Java had proper nesting, we probably wouldn't need packages, modules, OSGI bundles etc Commented Oct 18, 2016 at 1:37
  • Functional Programming as in the paradigm. For some reason I thought it was necessary background. In hindsight it doesn't fulfill any useful purpose and is more confusing than anything. I edited out. I agree, my function is poorly named. I think my biggest issue is that I fail to define the purpose of my function and thus I start expanding them before I even finish them. Commented Oct 18, 2016 at 1:37
  • Oh, and +1 for all the rest. Commented Oct 18, 2016 at 1:37
  • 1
    @JörgWMittag Sorry, I have to disagree. Using IIFEs are a horrible way to modularize your code. ECMAScript has no support for modularity. That's why people had to resort to nested function definitions as a crutch. The same could be done with any language that supports nested function definitions, and nested function definitions are so basic and essential that any language that doesn't support them has already failed. Java should not be used as the benchmark of modular language design. Full-blown module support (ala OCaml, or heck even Python) is much much better. Commented Oct 18, 2016 at 1:46
  • @Ucenna Yes, I know you were talking about the paradigm. I'm saying that the paradigm is ill-defined. For example, what makes the code you posted "functional"? Commented Oct 18, 2016 at 1:48