Reputation
2,026
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
8 11
Newest
 Enlightened
Impact
~31k people reached

Apr
12
comment What are the drawbacks of making a multi-threaded JavaScript runtime implementation?
Because automatically coordinating random state between threads is considered a nearly impossible problem so you have no credibility that you can offer anything that does it automatically. And, if you're just going to put the burden back on the developer like Java or C++ do, then most node.js programmers don't want that burden - they like that node.js doesn't have to deal with that for the most part. If you want a more sympathetic ear, you will have to explain/show how and what you would offer in this regard and why it would be good and useful.
Apr
12
comment What are the drawbacks of making a multi-threaded JavaScript runtime implementation?
Well, making anything that automatically coordinates and protects access to shared data between multiple threads is a really hard or nearly impossible problem. Presumably, it can be done for a single variable, but most state is much more involved than that and I can't even imagine how you could automatically do it. So, without any credibility for how you'd do it safely and usefully, put me in the doubting Thomas category. The onus is on you to prove you could do something useful in that regard.
Apr
12
comment What are the drawbacks of making a multi-threaded JavaScript runtime implementation?
How do you plan on handling multi-threaded access to shared state? "Marked as atomic and contend for access" does not explain how you think this would really work. I would guess that negative attitudes toward the idea are because people have no idea how you'd actually make this work. Or, if you're putting all the burden on the developer like in Java or C++ to use proper mutexes and such, then people are probably thinking why do they want that complication and programming risk in an environment that is free from it.
Jan
25
comment in dynamic language like javascript how do you know what the argument is?
Documentation, sample code, examining source of the function. Those are the options in Javascript. There is no strict method in Javascript to determine a function argument type because Javascript does not use types for declaring arguments.
Jan
9
comment Should I be returning promises from any function that uses them?
@Basilevs - I added another paragraph to the end of my answer.
Jan
9
comment Should I be returning promises from any function that uses them?
@Basilevs - well, that's just the way it is with async. Any operation that uses an async API immediately changes the entire operation to be async. There's nothing you can do about that - that's just the way it is.
Dec
28
comment Why does Node not support several event loops in one Process?
Any time multiple threads all have access to the same data, the developer must protect ALL shared data with mutexes. This adds significant overhead, significant complexity and great difficultly to fully test, thus often leads to hidden bugs. Any design that avoids as much of that complexity is generally a good thing and that is node.js out of the box. It avoids that completely. If you want to use multiple threads or processes, you can do that yourself with something like the clustering module or by starting up child processes and then YOU coordinate access to whatever data must be shared.
Dec
9
comment Will ECMAScript add classes to JavaScript? What does this mean?
@BasileStarynkevitch - Code example added.
Oct
21
comment Is this the preferred way to do inheritance in JavaScript?
Yes, that is the typical method of inheritance in Javascript. It's not the only way to do things, but this is a common method.
Sep
21
comment Is there a reason not to use HTML5 local storage for content
Don't forget about making SEO work. And, do you really need to reinvent browser caching?
Jun
11
comment JS Async: . Can I forget callbacks all together and replace with promises and/or generators
Promises will be a lot, lot cleaner than plain callbacks. But, keep in mind that promises work via callbacks too, they just offer you a lot more functionality and structure for use with those callbacks.
Jun
10
comment What is the best way to go about storing application options: file system or db?
File system vs. database Google search. Lots of articles to read. The answer is that "it depends" upon a lot of factors that are unique to your particular application.
Apr
27
comment Why is it common to put an underscore before a method in JavaScript?
Often, an underscore prefix means this method is not meant for public consumption. I don't know about jQuery UI specifically.
Mar
23
comment Are web sockets a browser feature or supplied by a specific OS version?
@AlexLL - All versions of OSes have TCP/IP which is the only thing webSockets need from the OS. So, yes you can run the latest Firefox on XP (if Firefox chooses to support XP) and webSockets will work there.
Mar
4
comment Executing scripts in parallel based on dependency tree
You get parallelism from the OS by spawning separate processes for each task you want to run in parallel. You get serial execution by running one task and then monitoring its completion before you start the next task. The specifics of how to do this depend entirely upon which development environment you choose to write the controlling program in.
Feb
24
comment Is there any reason to use the “var” keyword in ES6?
I haven't tried this yet (since I'm not yet writing ES6 code), but it seems that using var as a conscious indicator that this variable is intended to be scoped to the entire function might be a useful "self-documenting" convention.
Feb
8
comment Should I prefer classes or singletons in JavaScript/Node?
I wouldn't design yourself into a singleton design unless the type of object could NEVER have more than one. If you might ever want more than one, then you may as well design an object that you can instantiate more than one of.
Jan
30
comment Why is the Document Object Model the view?
The DOM is the visual representation or visual presentation. Most people would call that the view (what you see and what a user interacts with). It's the Document Object Model to the browser which just means it's the structure that the browser uses to display things, but it's not the data model or object model of your app. Yes, the terminology is a bit unfortunate, but it's not your app's model - that would be something completely different.
Jan
8
comment JavaScript program design: to what degree should I separate logic and display?
My preferred answer here is that you should assess your immediate goal and any likely future goals you might have with this code and find a design that is clear, concise, extensible in likely directions, yet efficient in implementation. This means you don't go way out of your way to decouple things that are unlikely to need to be decoupled, but at the same time, you pick an intelligent architecture that is easy to understand, implement, debug and produce solid maintainable code with while meeting the needs of your immediate project and any likely follow-on projects.
Jan
8
comment JavaScript program design: to what degree should I separate logic and display?
Javascript, by its nature is NO more coupled to the HTML and CSS than you write it to be. Your Javascript code has no generic coupling to your HTML or CSS unless you make it be coupled. So, I think your supposition here is entirely flawed that by its nature things are coupled - they aren't.