I guess we just don't agree then, I find this alternative very unintuitive.

On Nov 2, 2011, at November 2, 20112:02 PM, Erik Arvidsson wrote:

> On Wed, Nov 2, 2011 at 13:39, Mikeal Rogers <[email protected]> wrote:
> 
> var generateModelClass = function(columns) {
> 
> 
> 
> 
> 
>   var definition = {};
> 
> 
> 
> 
> 
>   columns.forEach(function(col) {
> 
> 
>     definition['get' + col] = function() {
> 
> 
>       return this[col];
> 
> 
>     };
> 
> 
>     definition['set' + col] = function(value) {
> 
> 
>       return this[col] = value;
> 
> 
>     };
> 
> 
>   });
> 
> 
> 
> 
> 
>   return class definition;
> 
> 
> 
> 
> 
> };
> 
> 
> 
> I feel like this is too strange to my liking. With something more along what 
> Brendan was suggesting the same could be done like this:
> 
> 
> var generateModelClass = function(columns) {
> 
> 
>   var c = class {},
> 
> 
>       p = returnClass.prototype;
> 
> 
> 
> 
> 
>   columns.forEach(function(col) {
> 
> 
>     p['get' + col] = function() {
> 
> 
>       return this[col];
> 
> 
>     };
> 
> 
>     p['set' + col] = function(value) {
> 
> 
>       return this[col] = value;
> 
> 
>     };
> 
> 
>   });
> 
> 
> 
> 
> 
>   return c;
> 
> 
> };
> 
> 
> 
> -- 
> erik

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to