1
0
Fork 0

Updated README and TODO with visibility status

closure/master
Mike Gerwitz 2011-03-07 23:13:06 -05:00
parent 960be880ab
commit a23d413a73
2 changed files with 15 additions and 16 deletions

View File

@ -11,7 +11,7 @@ Current support includes:
* Classical inheritance * Classical inheritance
* Abstract classes and methods * Abstract classes and methods
* Interfaces * Interfaces
* Near-completed visibility support in `visibility/master` branch * Visibility support (public, protected and private members)
**This project is still under development.** **This project is still under development.**
@ -41,12 +41,12 @@ class. The constructor is provided as the `__construct()` method (influenced by
{ {
foo: '', foo: '',
__construct: function( foo ) 'public __construct': function( foo )
{ {
this.foo = foo; this.foo = foo;
}, },
someMethod: function() 'public someMethod': function()
{ {
console.log( 'someMethod() called' ); console.log( 'someMethod() called' );
}, },
@ -78,7 +78,7 @@ planned features and should be available shortly.**
var SubFoo = Foo.extend( var SubFoo = Foo.extend(
{ {
anotherMethod: function() 'public anotherMethod': function()
{ {
}, },
}); });
@ -87,7 +87,7 @@ planned features and should be available shortly.**
// the same effect as above, even if Foo was created using Class.extend()) // the same effect as above, even if Foo was created using Class.extend())
var SubFoo = Class.extend( Foo, var SubFoo = Class.extend( Foo,
{ {
anotherMethod: function() 'public anotherMethod': function()
{ {
}, },
}); });
@ -103,10 +103,10 @@ they contain one or more abstract methods.
{ {
// a function may be provided if you wish the subtypes to implement a // a function may be provided if you wish the subtypes to implement a
// certain number of arguments // certain number of arguments
'abstract fooBar': [ 'arg' ], 'abstract public fooBar': [ 'arg' ],
// alternatively, you needn't supply implementation details // alternatively, you needn't supply implementation details
'abstract fooBar2': [], 'abstract public fooBar2': [],
}); });
If the abstract method provides implementation details (as shown by If the abstract method provides implementation details (as shown by
@ -122,11 +122,11 @@ be considered abstract.
// abstract methods // abstract methods
var ConcreteFoo = AbstractFoo.extend( var ConcreteFoo = AbstractFoo.extend(
{ {
fooBar: function( arg ) 'public fooBar': function( arg )
{ {
}, },
fooBar2: function() 'public fooBar2': function()
{ {
}, },
}); });
@ -134,7 +134,7 @@ be considered abstract.
// cannot be instantiated because one abstract method remains // cannot be instantiated because one abstract method remains
var StillAbstractFoo = AbstractFoo.extend( var StillAbstractFoo = AbstractFoo.extend(
{ {
fooBar: function( arg ) 'public fooBar': function( arg )
{ {
}, },
}); });
@ -155,14 +155,14 @@ an interface must be declared as abstract.
var MyType = Interface( var MyType = Interface(
{ {
'abstract foo': [] 'abstract public foo': []
}); });
To implement an interface, use the `implement()` class method: To implement an interface, use the `implement()` class method:
var ConcreteType = Class.implement( MyType ).extend( var ConcreteType = Class.implement( MyType ).extend(
{ {
foo: function() {} 'public foo': function() {}
}); });

7
TODO
View File

@ -14,15 +14,14 @@ Misc
cannot be used (# is not a valid token) cannot be used (# is not a valid token)
- Class module is becoming too large; refactor - Class module is becoming too large; refactor
Property Keywords Member Keywords
- Restrictions; throw exceptions when unknown keywords are used - Restrictions; throw exceptions when unknown keywords are used
- public (default)
- private; 'this' will contain private members of self, but not private
members of parents
- const; immutable properties - const; immutable properties
- final; methods cannot be overridden by subtypes - final; methods cannot be overridden by subtypes
- static; method/property accessible via class definition - static; method/property accessible via class definition
- event; designates a supported event - event; designates a supported event
- Concrete types must implement member with same visibility, or greater
visibility, than the abstract implementation defined
Typing Typing
- Support JSDoc-style type definitions for parameters - Support JSDoc-style type definitions for parameters