Re: A few more module questions

2011-04-07 Thread Brendan Eich
On Apr 4, 2011, at 9:51 AM, P T Withington wrote: On 2011-04-04, at 12:40, Sam Tobin-Hochstadt wrote: Renaming: - I find this syntax slightly unintuitive: import Geometry.{draw: drawShape} At first glance this would mean for me: rename drawShape to draw. draw feels to me like the result

Re: A few more module questions

2011-04-07 Thread Erik Arvidsson
On Thu, Apr 7, 2011 at 12:20, Brendan Eich bren...@mozilla.com wrote: Fortunately there's a short-hand:  let {draw, move} = GraphixAPIObject; Given this, is there any reason for anything but import ModuleName.* then? -- erik ___ es-discuss mailing

Re: A few more module questions

2011-04-06 Thread David Herman
The way I think about it is, whenever you have X: Y where X and Y are identifiers, the one on the left is fixed and the one on the right is variable. - In an object literal, the one on the left is a symbolic property name and the one on the right is a variable. - In destructuring, the one on

Re: A few more module questions

2011-04-06 Thread Axel Rauschmayer
Right. In this case, pattern matching object literals is a good metaphor, assignment (lhs is new, rhs is old) isn't. On Apr 6, 2011, at 17:12 , David Herman wrote: The way I think about it is, whenever you have X: Y where X and Y are identifiers, the one on the left is fixed and the one on

Re: A few more module questions

2011-04-06 Thread Axel Rauschmayer
Maybe I was over-thinking this problem: I was wondering how to access module-global data if this is shaded. It seemed similar to the var self = this work-around when using non-methods inside methods (forEach() etc.). module Foo { var bar = abc; // like a global inside this module, right?

A few more module questions

2011-04-04 Thread Axel Rauschmayer
Binding this: - Does it ever make sense to access globals via this? If so, I assume there will be a use case in the upcoming modules rationale document. - Should there be a keyword for the current module (a module-this, if you will)? Accessing module-global data via this feels strange (I that is

Re: A few more module questions

2011-04-04 Thread Sam Tobin-Hochstadt
Responding to a few of these: On Mon, Apr 4, 2011 at 12:33 PM, Axel Rauschmayer a...@rauschma.de wrote: - I think Python uses directories for namespace nesting, which has some pros and cons compared to completely abstracting the file system structure. It's necessary to completely abstract

Re: A few more module questions

2011-04-04 Thread Axel Rauschmayer
Renaming: - I find this syntax slightly unintuitive: import Geometry.{draw: drawShape} At first glance this would mean for me: rename drawShape to draw. draw feels to me like the result of the import. This is based on the destructuring syntax, where this: let {draw: drawShape} = ...

Re: A few more module questions

2011-04-04 Thread P T Withington
On 2011-04-04, at 12:40, Sam Tobin-Hochstadt wrote: Renaming: - I find this syntax slightly unintuitive: import Geometry.{draw: drawShape} At first glance this would mean for me: rename drawShape to draw. draw feels to me like the result of the import. This is based on the destructuring