Similar discussion here: http://www.mail-archive.com/[email protected]/msg10692.html
On Tue, Jan 31, 2012 at 5:18 AM, Herby Vojčík <[email protected]> wrote: > With .{...} around, I wonder, do we really need special class construct > with its own structure? I think with a little set of changes, minimal, > well-blended solution would be possible: > > 1. Allow <| for function declarations. > > SuperFun <| > function fun(...) { > ... > } > > 2. Allow .{} for function declarations. > > function gz(compress=false, blob) { > ... > }.{ > GZIP := 2, // := is const member as in actual proposal > DEFLATE := 4 > } > > 3. Define keyword 'class' to do exact same thing as function (declare > function or return expression; setting up empty prototype and constructor > property in it), with only one difference - it's completion value will be > the prototype, not the constructor. > > Animal <| > class Fox (...) { > // instance initialzation > }.{ > // instance-shared behaviour (aka prototype) > } > > Fox.{ > // optionally some static ones > } > > Class-private is the only hard thing. Well, I'd be able to live without > it. Just put a private keyword before the class declaration. No big issue, > if you want to reuse later, you will, if not, you will not; just don't > export it; it will be local to the scope in which class was defined, it may > be enough. > > Herby > ______________________________**_________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss> >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

