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.
-
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 etcJörg W Mittag– Jörg W Mittag2016-10-18 01:37:04 +00:00Commented 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.Ucenna– Ucenna2016-10-18 01:37:09 +00:00Commented Oct 18, 2016 at 1:37
-
Oh, and +1 for all the rest.Jörg W Mittag– Jörg W Mittag2016-10-18 01:37:53 +00:00Commented 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.gardenhead– gardenhead2016-10-18 01:46:47 +00:00Commented 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"?gardenhead– gardenhead2016-10-18 01:48:05 +00:00Commented Oct 18, 2016 at 1:48
|
Show 1 more comment
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you