Hash style comments

Rick Waldron waldron.rick at gmail.com
Wed Aug 8 16:38:49 PDT 2012

On Wed, Aug 8, 2012 at 7:16 PM, Trans <transfire at gmail.com> wrote:

> On Wed, Aug 8, 2012 at 1:03 PM, Rick Waldron <waldron.rick at gmail.com>
> wrote:
> >
> > There are none left.
> There are always symbol combinations (`//` is one).

"//" is single line comments

> Things like `/\`,

The parser will likely think that is a regular expression literal

>  `||`,

This is logical OR

> `<>`, `~>`

Sure, but does this conflict with your next argument?

> etc.   But maybe it should indicate its time to start
> thinking about other ways of doing things instead of adding more
> "perlism".

See above.

> I really don'tlike the idea that Javascript is going to ue
> `#`


> for something else since I am do so much coding in Ruby and shell
> scripting.
> > Prototype-less data structures are nice when you want to avoid the
> baggage
> > that comes with using Object objects ie. "inheriting" everything
> (methods,
> > etc) via the [[Prototype]]
> That sort of begs the question. Why would it be a good idea to avoid
> the baggage?

This is a well known pattern, there isn't much question begging here:

> var o = {};
> o.hasOwnProperty
[Function: hasOwnProperty]

> var o = Object.create(null)
> o.hasOwnProperty

> var o = { __proto__: null }
> o.hasOwnProperty

The last two won't inherit from Object.prototype and won't have prototype
chain lookups, property name conflicts etc[0][1]

> Is there some huge speed improvement in doing so? It
> seems like a very bad idea to use such an object beyond anything but
> internal variables. You wouldn't want to use these for properties, it
> would be a crippled API, wouldn't it?

See footnote links

[1] http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120808/32c274e9/attachment.html>

More information about the es-discuss mailing list