<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for dherman at mozilla</title>
	<atom:link href="http://blog.mozilla.com/dherman/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/dherman</link>
	<description>language engineering on the web</description>
	<lastBuildDate>Sat, 03 Dec 2011 17:40:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by FremyCompany</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1466</link>
		<dc:creator>FremyCompany</dc:creator>
		<pubDate>Sat, 03 Dec 2011 17:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1466</guid>
		<description>Another good solution would be to FIX the ASI to automatically insert a semicolon EXCEPT if the statement on current line doesn&#039;t make sense (there&#039;s a parenthesis open, it ends with an operator, ...) OR if the next line starts with a binary operator OR a dot.

This is the way VB.NET does it, I really like it. I almost never have problems when using Autmatic Line Continuation (and, BTW, most statements are written in one single line).

&lt;code&gt;var a = function() { // doesn&#039;t make sense, continue to next line
// ...
} // makes sense; the next line doesn&#039;t start by operator or dot -&gt; stop parsing statement and create a new one
(a &#124;&#124; b) // make sense, but next line starts with a dot
   .doSomething() // make sense, but next line starts with a dot
   .doSomethingElse()&lt;/code&gt;

Current ASI behavior is broken. We seriously need to fix that a day or another.</description>
		<content:encoded><![CDATA[<p>Another good solution would be to FIX the ASI to automatically insert a semicolon EXCEPT if the statement on current line doesn&#8217;t make sense (there&#8217;s a parenthesis open, it ends with an operator, &#8230;) OR if the next line starts with a binary operator OR a dot.</p>
<p>This is the way VB.NET does it, I really like it. I almost never have problems when using Autmatic Line Continuation (and, BTW, most statements are written in one single line).</p>
<p><code>var a = function() { // doesn't make sense, continue to next line<br />
// ...<br />
} // makes sense; the next line doesn't start by operator or dot -&gt; stop parsing statement and create a new one<br />
(a || b) // make sense, but next line starts with a dot<br />
   .doSomething() // make sense, but next line starts with a dot<br />
   .doSomethingElse()</code></p>
<p>Current ASI behavior is broken. We seriously need to fix that a day or another.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by dherman</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1462</link>
		<dc:creator>dherman</dc:creator>
		<pubDate>Fri, 02 Dec 2011 23:20:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1462</guid>
		<description>@Neil:

Fair enough — good food for thought.</description>
		<content:encoded><![CDATA[<p>@Neil:</p>
<p>Fair enough — good food for thought.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by Neil Rashbrook</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1461</link>
		<dc:creator>Neil Rashbrook</dc:creator>
		<pubDate>Fri, 02 Dec 2011 17:51:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1461</guid>
		<description>I did consider assignment syntax but I couldn&#039;t see how that would extend to getters and setters.</description>
		<content:encoded><![CDATA[<p>I did consider assignment syntax but I couldn&#8217;t see how that would extend to getters and setters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by dherman</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1460</link>
		<dc:creator>dherman</dc:creator>
		<pubDate>Fri, 02 Dec 2011 17:25:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1460</guid>
		<description>@allesio:

I agree that it can be abused, but I feel the same way about excessive amounts of method chaining. IMO, this simply provides a clearer way of doing what people currently do, but distinguishing when you&#039;re using method chaining for side effect (with a method that returns &lt;code&gt;this&lt;/code&gt;), and when you&#039;re using it to get a new value. But if you don&#039;t like the style of lots of nested method chaining, you certainly don&#039;t have to use it. Taste in programming style is always going to vary.

As for backwards compatibility, you bet — we are always vigilant about compatibility.</description>
		<content:encoded><![CDATA[<p>@allesio:</p>
<p>I agree that it can be abused, but I feel the same way about excessive amounts of method chaining. IMO, this simply provides a clearer way of doing what people currently do, but distinguishing when you&#8217;re using method chaining for side effect (with a method that returns <code>this</code>), and when you&#8217;re using it to get a new value. But if you don&#8217;t like the style of lots of nested method chaining, you certainly don&#8217;t have to use it. Taste in programming style is always going to vary.</p>
<p>As for backwards compatibility, you bet — we are always vigilant about compatibility.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by dherman</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1459</link>
		<dc:creator>dherman</dc:creator>
		<pubDate>Fri, 02 Dec 2011 17:21:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1459</guid>
		<description>@Neil:

Definitely useful for prototypes. For regular methods, I would just use assignment instead of mixing it up with function declaration syntax:

foo.prototype.{
    neg = function() { this._bar = -this._bar; }
};

I could see adding a get syntax. Interesting thoughts, definitely worth considering. Thanks!</description>
		<content:encoded><![CDATA[<p>@Neil:</p>
<p>Definitely useful for prototypes. For regular methods, I would just use assignment instead of mixing it up with function declaration syntax:</p>
<p>foo.prototype.{<br />
    neg = function() { this._bar = -this._bar; }<br />
};</p>
<p>I could see adding a get syntax. Interesting thoughts, definitely worth considering. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by alessioalex</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1458</link>
		<dc:creator>alessioalex</dc:creator>
		<pubDate>Fri, 02 Dec 2011 15:02:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1458</guid>
		<description>In my opinion this code looks really ugly :( I hope at least that backwords compatibility is kept if this code is implemented.</description>
		<content:encoded><![CDATA[<p>In my opinion this code looks really ugly <img src='http://blog.mozilla.com/dherman/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  I hope at least that backwords compatibility is kept if this code is implemented.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by Neil Rashbrook</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1457</link>
		<dc:creator>Neil Rashbrook</dc:creator>
		<pubDate>Fri, 02 Dec 2011 11:10:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1457</guid>
		<description>This looks like it could be extended into a sane method for defining prototypes. Currently we can either do something like
&lt;code&gt;
function foo(bar) {
  this._bar = bar;
}
foo.prototype = {
  neg: function neg() {
    this._bar = -this._bar;
  },
  get bar() {
    return this._bar;
  }
};
&lt;/code&gt;
but that destroys properties on the existing prototype, such as foo.prototype.constructor, which is bad for potential inheritance, or
&lt;code&gt;
function foo(bar) {
  this._bar = bar;
}
foo.prototype.neg = function neg() {
  this._bar = -this._bar;
};
foo.prototype.__defineGetter__(&quot;bar&quot;, function() {
  return this._bar;
});
&lt;/code&gt;
which is longwinded despite using SpiderMonkey-specific syntax. Instead I would like to see this:
&lt;code&gt;
function foo(bar) {
  this._bar = bar;
}
foo.prototype.{
  function neg() {
    this._bar = -this._bar;
  }
  get bar () {
    return this._bar; 
  };
};
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>This looks like it could be extended into a sane method for defining prototypes. Currently we can either do something like<br />
<code><br />
function foo(bar) {<br />
  this._bar = bar;<br />
}<br />
foo.prototype = {<br />
  neg: function neg() {<br />
    this._bar = -this._bar;<br />
  },<br />
  get bar() {<br />
    return this._bar;<br />
  }<br />
};<br />
</code><br />
but that destroys properties on the existing prototype, such as foo.prototype.constructor, which is bad for potential inheritance, or<br />
<code><br />
function foo(bar) {<br />
  this._bar = bar;<br />
}<br />
foo.prototype.neg = function neg() {<br />
  this._bar = -this._bar;<br />
};<br />
foo.prototype.__defineGetter__("bar", function() {<br />
  return this._bar;<br />
});<br />
</code><br />
which is longwinded despite using SpiderMonkey-specific syntax. Instead I would like to see this:<br />
<code><br />
function foo(bar) {<br />
  this._bar = bar;<br />
}<br />
foo.prototype.{<br />
  function neg() {<br />
    this._bar = -this._bar;<br />
  }<br />
  get bar () {<br />
    return this._bar;<br />
  };<br />
};<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by Justin Dolske</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1454</link>
		<dc:creator>Justin Dolske</dc:creator>
		<pubDate>Fri, 02 Dec 2011 05:23:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1454</guid>
		<description>Just came here to say hooray for nattybo! \o/</description>
		<content:encoded><![CDATA[<p>Just came here to say hooray for nattybo! \o/</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by dherman</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1453</link>
		<dc:creator>dherman</dc:creator>
		<pubDate>Fri, 02 Dec 2011 05:18:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1453</guid>
		<description>@Mook:

I suggested a reformed &lt;code&gt;with&lt;/code&gt; using the prefix dot-notation like your suggestion a long time ago, and it has a really bad interaction with semicolon insertion: notice how in the assignments in your example, they end with an expression, and the next line starts with a dot? That means that there&#039;s no inserted semicolon! Semicolons are only inserted if it can&#039;t parse, and 17.bar and &quot;hello&quot;.baz parse just fine.</description>
		<content:encoded><![CDATA[<p>@Mook:</p>
<p>I suggested a reformed <code>with</code> using the prefix dot-notation like your suggestion a long time ago, and it has a really bad interaction with semicolon insertion: notice how in the assignments in your example, they end with an expression, and the next line starts with a dot? That means that there&#8217;s no inserted semicolon! Semicolons are only inserted if it can&#8217;t parse, and 17.bar and &#8220;hello&#8221;.baz parse just fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Now that&#8217;s a nice &#8216;stache by Mook</title>
		<link>http://blog.mozilla.com/dherman/2011/12/01/now-thats-a-nice-stache/comment-page-1/#comment-1452</link>
		<dc:creator>Mook</dc:creator>
		<pubDate>Fri, 02 Dec 2011 05:03:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dherman/?p=126#comment-1452</guid>
		<description>Sounds like it actually really wants to be &lt;code&gt;with()&lt;/code&gt;; if you merge the first example and your proposed syntax, you get something unambiguous (though a little wordy):
&lt;code&gt;
array.{
  .pop()
  .pop()
  .pop()
}
path.{
  .moveTo(10, 10)
  .stroke(&quot;red&quot;)
  .fill(&quot;blue&quot;)
  .ellipse(50, 50)
}
this.{
  .foo = 17
  .bar = &quot;hello&quot;
  .baz = true
}
&lt;/code&gt;

(I&#039;m assuming automatic semicolon insertion here to match your examples; I&#039;d personally prefer to be explicit, though.)  Yes, that&#039;s basically copying the VB with syntax - but hey, if it manged to do &lt;em&gt;something&lt;/em&gt; right, why not learn from it?  This way we can use other variables too:
&lt;code&gt;
this.{
  alert(&quot;dimensions are &quot; + .width + &quot; x &quot; + .height);
}
&lt;/code&gt;
(Let&#039;s assume the deepest mono-stache wins when you nest them, or something...)</description>
		<content:encoded><![CDATA[<p>Sounds like it actually really wants to be <code>with()</code>; if you merge the first example and your proposed syntax, you get something unambiguous (though a little wordy):<br />
<code><br />
array.{<br />
  .pop()<br />
  .pop()<br />
  .pop()<br />
}<br />
path.{<br />
  .moveTo(10, 10)<br />
  .stroke("red")<br />
  .fill("blue")<br />
  .ellipse(50, 50)<br />
}<br />
this.{<br />
  .foo = 17<br />
  .bar = "hello"<br />
  .baz = true<br />
}<br />
</code></p>
<p>(I&#8217;m assuming automatic semicolon insertion here to match your examples; I&#8217;d personally prefer to be explicit, though.)  Yes, that&#8217;s basically copying the VB with syntax &#8211; but hey, if it manged to do <em>something</em> right, why not learn from it?  This way we can use other variables too:<br />
<code><br />
this.{<br />
  alert("dimensions are " + .width + " x " + .height);<br />
}<br />
</code><br />
(Let&#8217;s assume the deepest mono-stache wins when you nest them, or something&#8230;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

