Re: Using monocle mustache for chaining.

2011-11-12 Thread Allen Wirfs-Brock
On Nov 11, 2011, at 5:22 PM, David Herman wrote: On Nov 11, 2011, at 4:18 PM, Rick Waldron wrote: Dave, if nesting were out of the question and monocle-mustache operator always looked like an object literal as they currently exist, would it still be as vile? With that form, I'm a big

Re: Using monocle mustache for chaining.

2011-11-12 Thread Brendan Eich
On Nov 12, 2011, at 9:48 AM, Allen Wirfs-Brock wrote: On Nov 11, 2011, at 5:22 PM, David Herman wrote: On Nov 11, 2011, at 4:18 PM, Rick Waldron wrote: Dave, if nesting were out of the question and monocle-mustache operator always looked like an object literal as they currently exist,

Re: Using monocle mustache for chaining.

2011-11-12 Thread Mike Samuel
2011/11/11 Erik Arvidsson erik.arvids...@gmail.com: We've all looked at jQuery code and envied the conciseness of its chaining APIs. Most of us also looked at it and thought; Yuk, making everything a method of jQuery and always return the jQuery object is ugly. However, I (with some help)

Re: Using monocle mustache for chaining.

2011-11-12 Thread Brendan Eich
On Nov 12, 2011, at 12:22 PM, Axel Rauschmayer wrote: [Apologies for interrupting...] No problem! If we do classes, what .{ use-cases remain? The operator allows you to use object literals (including all of the niceties that will be introduced in ES.next) where you previously had to do

Re: Using monocle mustache for chaining.

2011-11-12 Thread Axel Rauschmayer
More: function Point(x, y) { this.{x,y}; } function Monster(name) { this.{ name: name, @strength: 10, @age: 0 }; } // namespace exists in multiple files (possibly less relevant with modules) namespace.{ function1() { }, function2() { } } If

Re: Using monocle mustache for chaining.

2011-11-12 Thread Brendan Eich
On Nov 12, 2011, at 1:20 PM, Axel Rauschmayer wrote: More: function Point(x, y) { this.{x,y}; } Ok, maybe. But function Monster(name) { this.{ name: name, just name here should do, not name: name -- right? @strength: 10, @age: 0 }; } Someone

Re: Using monocle mustache for chaining.

2011-11-12 Thread Axel Rauschmayer
function Point(x, y) { this.{x,y}; } Ok, maybe. But function Monster(name) { this.{ name: name, just name here should do, not name: name -- right? Ah, I thought one couldn’t mix the key-value form and the value-less syntactic sugar. But it makes sense to allow

Using monocle mustache for chaining.

2011-11-11 Thread Erik Arvidsson
We've all looked at jQuery code and envied the conciseness of its chaining APIs. Most of us also looked at it and thought; Yuk, making everything a method of jQuery and always return the jQuery object is ugly. However, I (with some help) realized that the .{ operator can be used to solve most of

RE: Using monocle mustache for chaining.

2011-11-11 Thread Luke Hoban
document.querySelector('#my-element').{ style.{ 'color': 'red', 'padding': '5px' }. textContent: 'Hello' }; I don't think I've seen this form of the .{ syntax discussed before. Is an expression being used as the LHS of an object literal property assignment? What does foo.{

Re: Using monocle mustache for chaining.

2011-11-11 Thread Bradley Meck
It appears to be assigning multiple properties in place and at once and returning the original object if I am understanding correctly. On Fri, Nov 11, 2011 at 1:27 PM, Luke Hoban lu...@microsoft.com wrote: document.querySelector('#my-element').{ style.{ 'color': 'red', 'padding':

Re: Using monocle mustache for chaining.

2011-11-11 Thread Oliver Hunt
I'm sorry, i don't understand the semantics you're going for here. What is document.querySelector('#myTable').{ querySelectorAll('.firstColumn').{ style.{background: 'red', border: '2px solid black'}, textContent: 'first column' }, querySelectorAll('.lastColumn').{

Re: Using monocle mustache for chaining.

2011-11-11 Thread Erik Arvidsson
On Fri, Nov 11, 2011 at 11:27, Luke Hoban lu...@microsoft.com wrote: document.querySelector('#my-element').{   style.{    'color': 'red',    'padding': '5px'  }.  textContent: 'Hello' }; I don't think I've seen this form of the .{ syntax discussed before.   Is an expression

Re: Using monocle mustache for chaining.

2011-11-11 Thread David Herman
On Nov 11, 2011, at 10:50 AM, Erik Arvidsson wrote: We've all looked at jQuery code and envied the conciseness of its chaining APIs. Most of us also looked at it and thought; Yuk, making everything a method of jQuery and always return the jQuery object is ugly. Beauty is in the eye of the

Re: Using monocle mustache for chaining.

2011-11-11 Thread Erik Arvidsson
On Fri, Nov 11, 2011 at 11:38, Oliver Hunt oli...@apple.com wrote: But ignoring that, the decision we made at last november's meeting was that DOM attributes would be specified as setters on the prototype, so someElement.style.{background:blue, border: 2px solid black} would add to own

Re: Using monocle mustache for chaining.

2011-11-11 Thread Rick Waldron
Dave, if nesting were out of the question and monocle-mustache operator always looked like an object literal as they currently exist, would it still be as vile? With that form, I'm a big fan. /Rick On Nov 11, 2011, at 3:13 PM, David Herman dher...@mozilla.com wrote: On Nov 11, 2011, at

Re: Using monocle mustache for chaining.

2011-11-11 Thread David Herman
On Nov 11, 2011, at 4:18 PM, Rick Waldron wrote: Dave, if nesting were out of the question and monocle-mustache operator always looked like an object literal as they currently exist, would it still be as vile? With that form, I'm a big fan. I'm of multiple minds (a condition I'm gradually

Re: Using monocle mustache for chaining.

2011-11-11 Thread Rick Waldron
While I was admiring the pros of its mutation, I overlooked how unclear it was that a mutation was even occurring... Anyway, thanks for the clarification. /Rick On Nov 11, 2011, at 8:22 PM, David Herman dher...@mozilla.com wrote: On Nov 11, 2011, at 4:18 PM, Rick Waldron wrote: Dave, if