On Apr 19, 2012, at 2:18 PM, Allen Wirfs-Brock wrote: > //initialize some variable with default objects > let { > unidentifedAdult: mom, > unidetifiedAdult: dad, > unidentiedChild: brother, > unidentifiedChild: sister > } = peopleConstants; > > why is this less desirable than: > > //initialize some variable with default objects > let mon = peopleConstants.unidentifiedAdult, > dad = peopleConstants.unidentifiedAdult, > brother = peopleConstants.unidentifiedChild, > sister = peopleConstants.unidentifiedChild;
Well, it's rare that you *need* to re-evaluate the dot-pattern. It saves typing, repetition (DRY!), side-effects, and running time to evaluate each selector only once: let mom = peopleConstants.unidentifiedAdult, dad = mom, brother = peopleConstants.unidentifiedChild, sister = brother; And you should be able to do that just fine with nested as-patterns: let { unidentifiedAdult: mom as dad, unidentifiedChild: sister as brother } or let { undentifiedAdult as mom as dad, unidentifiedChild as sister as brother } Dave _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss