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 the left is the fixed name of the property 
you're destructuring and the one on the right is the variable name you're 
locally binding.

- In module importing, the one on the left is the fixed name of the foreign 
export you're importing, and the one on the right is the variable name you're 
locally binding.

Dave

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 of the import.
>> 
>> This is based on the destructuring syntax, where this:
>> 
>> let {draw: drawShape} = ... some expression ...;
>> 
>> also binds the identifier |drawShape|.
> 
> FWIW, I read these destructuring patterns backwards too.  Must be a 
> left/right brain thing.  Something I will have to learn the hard way to make 
> it stick.
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to