A streamlined non-disturbing class possibility

Herby Vojčík herby at mailbox.sk
Tue Jan 31 10:55:42 PST 2012

Rick Waldron wrote:
> Similar discussion here:
> http://www.mail-archive.com/es-discuss@mozilla.org/msg10692.html

Thank you, I wasn't here yet at the time.
 From what I saw, it did a f(){}.prototype.{} or the like. It is the 
basic idea, but confusing, the .prototype.{... is not good.

What I tried, is to make it so it can fulfill the primary "class" goal - 
to create syntactic structure which people coming from class languages 
can take and use without too much hassle, while at the same time doing 
it so it is blended into the matter of the language well.

The twist of "class being a function equivalent returning the prototype" 
could do it (when <| is allowed for declarations). This:
>       Animal <|
>       class Fox (...) {
>         // instance initialzation
>       }.{
>         // instance-shared behaviour (aka prototype)
>       }
>       Fox.{
>         // optionally some static ones
>       }
is pretty sleak; the class (sans statics which are not so criticial) is 
defined in one piece of code with only a handful of rules, having only 
one keyword (class) and rest is "syntax". It can be copied as-is by 
beginniners and later understood that both <| and .{...} are in fact 
nothing special.


More information about the es-discuss mailing list