> it must be said the pattern I chose to bring more references ( e.g. the 
> object with .s and .t ) looks slower on average but I am big fun of code 
> reusability so I would say two or more functions that brings same references 
> through the object in order to perform same operations could be summarized as 
> single one ( kinda edge case though )
> 
> If only two references I would still prefer the "this" approach for one of 
> them rather than a lookup for both but for all other cases I said long time 
> ago this trend to create a new closure rather than use the second argument of 
> Array extras could not bring any advantage for both reusability and, now 
> demonstrated, performances.
> 
> It was nice to test it in any case so thanks.

I’m a big fan of code reuse and eliminating redundancy. However, I find that 
there is also such a thing as being too clever about it. For example, in 
functional programming there are some incredibly sophisticated things you can 
achieve, sometimes at the expense of easily understanding the code. Some foldr 
and foldl uses come to mind. So it’s always a balance.

I’ve incorporated several of your suggestions: 
https://github.com/rauschma/enums/blob/master/enums.js

Looking at your alternate implementation, I’m not sure that we’ll find common 
ground on all issues, though. My goal is making things as easy to understand as 
possible (highly subjective, I know). Your goal *seems* to be performance.

Thanks for the feedback!

Axel

-- 
Dr. Axel Rauschmayer
a...@rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



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

Reply via email to