Echo JS 0.11.0

<~>

naugtur comments

naugtur 3324 days ago. link 3 points
If you already have node of any version installed, there's a simple alternative I can recommend:

npm install -g n

and n will handle switching versions very comfortably

n 0.10.40 
installs if missing and switches

n
opens a dialog in terminal where you can choose from the list with arrow keys.
naugtur 3495 days ago. link 1 point
Cool features, although overall it's bloated.
If you're open to suggestions, mine is to split it to multiple composable modules that do one thing and do it well. (not saying that your current code doesn't do stuff well, but with small modules it's easier to be sure)
naugtur 3495 days ago. link 1 point
Like it wasn't hard enough to judge adoption of those milions of js libs...
naugtur 3498 days ago. link 2 points
That's far from a true HashMap still.
Try putting milions of entries in such "hashmap" and removing them (with nasty delete) and look at your heap size.

Use ES6 for predictable results.
naugtur 3510 days ago. link 1 point
For better trolling, add -g to the example command and claim "You'll never need to use npm again"
naugtur 3605 days ago. link 2 points
Pretty docs. Anyway, why do we need another one? And it doesnt even have tests or defined browser support.
Your energy could have been spent making an existing project better. Instead it's contributed to the overhead in choosing libraries. 
With the experience you got from this you could join an opensource project and help.
You can just look around github, plenty of really established projects want pull requests. Your talent will be better applied there ;)
naugtur 3656 days ago. link 1 point
The article describes a way to implement classical OOP in JavaScript using only features of the language available prior to ES5

Oh no, not again. :(
I see Author put lots of effort in building this and writing an article and I always feel for them. Implementing the old OOP in JavaScript is always time consuming and rewarding(at first). And a dead end.

Douglas Crockford did it over 10 years ago and regretted afterwards. Just one of the quotations: "I now see my early attempts to support the classical model in JavaScript as a mistake." 

The idea presented in the article will not evolve to a full classical OOP with classes and inheritance. And if it tries - it will most certainly fail with some unexpected behavior emerging or tons of crazy/scary boilerplate.

The way private variables are declared in the article defends any attempt at making the classical inheritance as far as I know. I tried to make private (as inside a closure) variables work well with inheritance and it's just not what JavaScript was created to do. See: https://github.com/naugtur/extendable-module
In my implementation the descendant objects would call inherited methods to modify variables in different objects instead of just themselves.

If there was a reasonable way around it, I bet it would already be insanely popular.


So, to the author of the article, and anybody who actually considers using the code from there:

Please take a look at new features in ECMA standards, they're being created to suit your needs. And they're developed by the best JS specialists there are.

Check out:
Object.create from ES5
Classes and modules in ES6
Web Components
Metaprogramming in ES6 - proxies (Proxy.create)


JavaScript is really powerful and expressive. Don't try to put it in the OOP straitjacket.
naugtur 3673 days ago. link 2 points
Eval is not used within logic so no security concerns here. The only  issue is that it will be blocked by content security policy if you have one.

Performance will be identical after the code gets interpreted and compiled, but you lose some precious time on decoding that during page load and init.

The only valid concern is that it actually does nothing to protect your code and makes your file much bigger. Whatever is passed to eval must be valid javascript anyway. It's kinda like saying that gzip compression on http increases privacy because it gets harder to read. 

There is no obfuscation that can be applied to javascript to prevent its reading because the browser needs to read it. This will remain true as long as jit compilers for js exist.
naugtur 3910 days ago. link 0 point
No matter how controversial, any personal opinion of a leader about any law doesn't create a hostile work environment unless (s)he decides to. Eich didn't have any problems accepting people at Mozilla. There were plenty of statements of LGBT(pick one) people stating that Eich treated them same as anybody else.

This being said, I do think that a person of weak character would decide to create an environment hostile to people (s)he doesn't share basic beliefs with. But people with weak character don't get elected to be community leaders in general.
[more]