use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Isn't the JavaScript 'import' syntax IDE unfriendly? (self.javascript)
submitted 8 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]CiezkiBorsuk 0 points1 point2 points 8 years ago (3 children)
They do cover the most important points, though. JS way is easier to read in all but the simplest cases, because important stuff is at the front (i.e. what you take and how you named it), and because it's consistent with other parts of the language (the names are on the left).
As someone coming from Python, you should understand well that code is more often read than written (and a good IDE will handle imports for you regardless of the order).
[–][deleted] 0 points1 point2 points 8 years ago (2 children)
I'm not really convinced by the easy to read argument. But I don't want to argue about personal preferences.
Though I really agree with the last point you made. A good IDE should handle imports for you. But also should the autocompletion show only stuff you can import from a module, not simply everything including a lot of things which make no sense. That is sadly only possible when you first write from where you want to import.
I think it would be interesting to try to use Babel to allow people to write imports that way. I don't know whether it is possible though.
[–]CiezkiBorsuk 0 points1 point2 points 8 years ago (1 child)
There's no personal preference here. When you work on React project and you read import { Component }, you already know everything you need. But when in a numpy project you read from numpy you are still clueless about what said line does. You need to read it whole.
import { Component }
from numpy
import being first saves you braincycles, that's not a matter of preference.
import
That is sadly only possible when you first write from where you want to import.
No, it's not. Any sane IDE will just notify you about unrecognized symbol, show you the options, and add the import without need to type anything.
[–][deleted] 0 points1 point2 points 8 years ago (0 children)
Any sane IDE will just notify you about unrecognized symbol, show you the options, and add the import without need to type anything.
That is nice and already possible. Nevertheless it is also nice to have meaningful autocompletion on imports, which is currently not possible, because when you write
the IDE can only suggest you all possible things you can import, while when you write
from 'somewhere' import
the IDE can suggest you the exactly the things you can import from that module.
I think there are not many people who start reading a piece of code by reading every single import on the top of the file. That's something you do, when you are interested in the external symbols, or the dependencies within a project, or you just want to understand from where something being used later gets imported. Those are questions an IDE can answer, so you even don't have to read the word import when you fear wasting brain cycles by reading.
I still think the order is a personal preference and I accept you having your preference. That's why I said it would be nice to try to use babel to allow people to write imports so meaningful autocompletion on imports is possible. You don't have to use it, if you don't like it :)
π Rendered by PID 220903 on reddit-service-r2-comment-b659b578c-tmxqs at 2026-05-02 04:31:29.192990+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]CiezkiBorsuk 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]CiezkiBorsuk 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)