G
Guillermo Rauch
devthought.com · Personal blog · on HN since 2009
Guillermo Rauch, creator of Socket.IO, wrote early Node.js and JavaScript posts about objects, tooling, browser bugs, and conference talks.
What HN saysHN links 'An Object is not a Hash', which one commenter calls naive and dangerous over reserved property names. Other links cover his tweet-filtering proxy and an RMS anecdote.
27HN people shared it
8linked it in comments
26stories submitted
536story points
11 years agolast shared
2009people per year2026
Most-shared posts
- 1An Object is not a Hash7 people · 75 points · first shared 2012 · 73 comments on HN
- 2Rms has his bag stolen in Argentina2 people · 92 points · first shared 2012 · 112 comments on HN
- 3JSConf 2010 Slides compilation2 people · 44 points · first shared 2010 · 1 comments on HN
- 4A String is not an Error2 people · 27 points · first shared 2011 · discussion on HN
- 5Node.native, NodeJS and Luvit(Lua) Showdown2 people · 13 points · first shared 2012 · 2 comments on HN
- 6A tweet filtering proxy in node.js2 people · 4 points · first shared 2012 · discussion on HN
- 7Understanding the iOS6 AJAX bugs2 people · 3 points · first shared 2012 · discussion on HN
- 8Chrome SPDY indicator (extension)1 people · 59 points · first shared 2012 · 12 comments on HN
- 9The Realtime Engine1 people · 52 points · first shared 2012 · 5 comments on HN
- 10Bash as a Service1 people · 43 points · first shared 2012 · 20 comments on HN
- 11Node.JS and the WebSocket protocol1 people · 31 points · first shared 2009 · discussion on HN
- 12A better console.log1 people · 28 points · first shared 2012 · 6 comments on HN
- 13Accessing a MySQL database from Node.JS1 people · 27 points · first shared 2009 · 14 comments on HN
- 14Getting rid of stale transactional email1 people · 19 points · first shared 2013 · 4 comments on HN
- 15The four stages of programming competence1 people · 12 points · first shared 2009 · 5 comments on HN
What HN people wrote when they linked it
malandrew · 2013-08-07
No you don't:
http://www.devthought.com/2012/01/24/filtering-tweets-for-your-favorit…
Proxlet did this as a service back in the day.
I've been toying with the idea of creating a project based on Guillermo R's post with a social component for sharing regexes and rules. The truth is that this type of local proxy should be a generalizable service for every service you consume.
dyoo1979 · 2015-07-12
... Yikes. The advice in this post is unfortunately naive. It's dangerous to allow arbitrary object attribute key content. Some object properties in JavaScript must be treated as reserved. Allowing arbitrary access to key names has unexpected repercussions. For example, consider "prototype" or "hasOwnProperty" as key names.
See: http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/ for more details.
So I'd +1 jestar_jokin's advice: use code that's been well-tested. The code presented in the original poster's "Hash Tables in Javascript" article does not look robust.
tjakab · 2015-05-17
The Lemote got stolen from him in 2012:
http://www.devthought.com/2012/06/09/richard-stallman-robbed-in-argent…
anon1385 · 2014-12-13
>The nicest part of it is the built-in hash table type and the related syntactic sugar that everyone for whatever reasons insists on calling "object".
People call it an object because that is what it is. If your code is using Javascript objects as general purpose hash tables with the normal syntactic sugar then your code is broken[1]. The correct way to use an object as a hash table involves a bunch of ugly extra syntax that makes it more verbose than hash tables in any other language I'm aware of.
[1] http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/
shabble · 2012-10-09
Also see http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/ from earlier about some pitfalls that you might not immediately consider.
(HN Thread: https://news.ycombinator.com/item?id=4629544)
petercooper · 2012-03-11
Similar in C++11: https://github.com/d5/node.native
And a simple example of using it (for a hello world benchmark): http://www.devthought.com/2012/02/08/node-http-hello-world-showdown/
Rauchg · 2010-06-22
Quick link to demo: http://devthought.com/wp-content/projects/chromekit/
masklinn · 2012-12-31
It's a bit sad that one of the most useful cases for `Object.create` was not covered: it is the only way to create an object without a prototype. Using constructor functions, even if you explicitly set the ``prototype`` to ``null``, instances's ``__proto__`` remains ``Object.prototype``:
> var F = function () {};
> F.prototype = null;
null
> (new F).__proto__ === Object.prototype;
true
This means all the "default" object methods are there (e.g. #hasOwnProperty) and ready to get clobbered with all the risk it entails[0].
With ``Object.create(null)``, however, the __proto__ of the created object is effectively ``null``:
> Object.create(null).__proto__
null
and such pesky methods as #hasOwnProperty or #toString are not there for clobbering.
And an issue of Object.create failed to be mentioned as well: you can't use ``instanceof`` directly, you have to create one-off "constructor functions" to call ``instanceof`` on them.
[0] http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/