Live data from Hacker News

Brendan Eich: The infernal semicolon

brendaneich.com

51–60 of 143 posts

Re: Brendan Eich: The infernal semicolon

#51
post #39
post #33

Heh, I was waiting for this post. Coming in the next 24 hours: - "Why I use minimal semi-colons in Javascript" - "ASI is broken but I like it" Honestly I'm shocked at the defense of this practice (of ASI "abusage"). It speaks loudly to Jacob's (fat@githib) ranking of ego-stroking and showboating over creating readable code, particularly for a library "Designed for everyone, everywhere" [1]. I'm confounded that such a…

> I'm confounded that such an attitude can survive in a large engineering organization like Twitter. I'm not surprised. A bit disappointed, but not surprised. Have a look at the original OAuth specification sometime. Note how they misuse the word "key" to mean "identifier". I can't imagine that anyone writing a crypto specification wouldn't know that this would be confusing; I think it's more likely that the person j…

> then there's the hashbang thing

Thank you. I agree both of these show a casual disregard for "how the real world works", where not everyone is a "rock star", some are lowest common denominators using the web as best they can (and good for them for even trying!), and some just need to get things done.

Every extra exception you require in a user's mind makes your work and the web in general just that little bit less accessible.

That it is being done for "style" in an arena of notoriously unsophisticated users, really feels like a giant middle finger.

Kudos to Google for their style guide freeing up this particular "exceptions" pigeonhole from a JS programmer's mind, so she can use the synapse to get something done instead.

// Using JS in the real world since Netscape 2.0.

Re: Brendan Eich: The infernal semicolon

#52
post #39

Earlier quoted context omitted.

> I'm confounded that such an attitude can survive in a large engineering organization like Twitter. I'm not surprised. A bit disappointed, but not surprised. Have a look at the original OAuth specification sometime. Note how they misuse the word "key" to mean "identifier". I can't imagine that anyone writing a crypto specification wouldn't know that this would be confusing; I think it's more likely that the person j…

> then there's the hashbang thing Thank you. I agree both of these show a casual disregard for "how the real world works", where not everyone is a "rock star", some are lowest common denominators using the web as best they can (and good for them for even trying!), and some just need to get things done. Every extra exception you require in a user's mind makes your work and the web in general just that little bit less…

Let's not forget... Twitter may have made the hashbang infamous, but it was originally championed by Google [1].

[1]: http://googlewebmastercentral.blogspot.com/2009/10/proposal-...

Re: Brendan Eich: The infernal semicolon

#53
post #16

I can't believe that I woke up this morning and more semicolon arguments are at the top of hackernews..

You haven't been around for long enough or just aren'y cynical enough, I went to bed knowing that there would be at least 5 more posts about it in the morning

And you thought one of those five would be from JS's inventor, participating in this thread? I didn't expect that -- makes me feel HN is still a great resource.

Re: Brendan Eich: The infernal semicolon

#55
post #42

Is it me, or did the author tack on a new topic regarding the use of && and ||? The fact that they return the controlling operand is quite useful. Consider a situation where you want to check the property of an object, but don't know if that object is null: var foo = obj && obj.bar; I find this much more readable than: var foo = null; if (obj) { foo = obj.bar; } You can accomplish the same thing with a ternary operat…

Your last parenthetical point is exactly why I'd avoid those uses of && and ||. Write a default_to() function (or a method in languages that allow methods to be defined on the null object) that wraps all those corner cases up.

Your post has made me realize however that I'm not sure if the language I'm reimplementing is meant to be value preserving in the case of those operators where an explicit corrosion from the a type to Boolean has been defined. Shows how often they're used like that in production code I guess.

Re: Brendan Eich: The infernal semicolon

#56
post #52

Earlier quoted context omitted.

> then there's the hashbang thing Thank you. I agree both of these show a casual disregard for "how the real world works", where not everyone is a "rock star", some are lowest common denominators using the web as best they can (and good for them for even trying!), and some just need to get things done. Every extra exception you require in a user's mind makes your work and the web in general just that little bit less…

Let's not forget... Twitter may have made the hashbang infamous, but it was originally championed by Google [1]. [1]: http://googlewebmastercentral.blogspot.com/2009/10/proposal-...

Page state and uniform resource location, I feel, are utterly different. Hash bang shouldn't be which user's tweets we're looking at, or which article on Gawker.

Google's examples show the hash bang after the query. Twitter put the query after the hash bang.

Re: Brendan Eich: The infernal semicolon

#57

Earlier quoted context omitted.

Lars Bak, who leads chrome's v8 team and was tech lead for java's hotspot vm, argues that javascript is a competitive 'bytecode' even compared to java or CLI bytecode [1]. Among other things, Bak claims that javascript source is more compact than traditional bytecode. [1] about 3/4 into this interview: http://channel9.msdn.com/Shows/Going+Deep/Expert-to-Expert-Erik-Meijer-and-Lars-Bak-Inside-V8-A-Javascript-Virtual-M…

I'm personally in favor of leaving JS mostly alone, especially at the syntax layer, and then let transcompiler solutions like CoffeeScript evolve to relieve the syntax burden and add semantic improvements. CoffeeScript is far from perfect--it has syntax quirks of its own--but it's more pleasant for me to write in, being used to Python and Ruby. (And, yes, I understand JavaScript too; I just don't like the syntax.) Ev…

Eventually transcompiler languages will evolve to take advantage of different JS engine improvements.

I wonder what opportunities there are here that haven't been exploited yet and that don't require replacing JS with a new language. For example, could JS implementors define a more-easily-optimizable subset of JS? Then transpilers seeking performance could target just that subset.

Re: Brendan Eich: The infernal semicolon

#59

Earlier quoted context omitted.

> If javascript were any worse, it may have been sidelined entirely before it had a chance to improve And we should keep using it in 2012, 17 years later?

JS has improved a lot in 17 years. It's still incumbent, and with ES6 and further Harmony work, it is still improving (much of ES6 are in V8 and SpiderMonkey, or coming very soon). Good luck displacing JS. I mean that sincerely, especially if you work in the open. Dart had a rough start but even ignoring that, I don't think it will succeed. We'll see.

This looks like a good place to fulfill a promise I made to report back if my hopes were dashed about Dart (http://news.ycombinator.com/item?id=2989686). They were dashed pretty quickly. I've seen nothing compelling enough to prefer Dart to a fixed-as-much-as-is-practical JS. Especially if such a JS becomes more suitable as a compilation target (better numerics and so on).

Re: Brendan Eich: The infernal semicolon

#60
post #33

Heh, I was waiting for this post. Coming in the next 24 hours: - "Why I use minimal semi-colons in Javascript" - "ASI is broken but I like it" Honestly I'm shocked at the defense of this practice (of ASI "abusage"). It speaks loudly to Jacob's (fat@githib) ranking of ego-stroking and showboating over creating readable code, particularly for a library "Designed for everyone, everywhere" [1]. I'm confounded that such a…

I'm surprised no one has made a little command line tool that follows the rules and automatically inserts semicolons according to the ASI spec.

That might even be useful.

Post reply on HN