ease.js - Tasks: task #12084, Concise constructor arguments
You are not allowed to post comments on this tracker with your current authentication level.
task #12084: Concise constructor arguments
Submitter: | Mike Gerwitz <mikegerwitz> | ||
Submitted: | Sat 09 Jun 2012 07:00:02 PM UTC | ||
Should Start On: | Sat 09 Jun 2012 04:00:00 AM UTC | Should be Finished on: | Wed 01 Aug 2012 04:00:00 AM UTC |
Category: | Core | Priority: | 7 - High |
Item Group: | Development | Status: | In Progress |
Privacy: | Public | Assigned to: | mikegerwitz |
Percent Complete: | 0% | Open/Closed: | Open |
Planned Release: | None | ||
Keywords: | constructor, classes |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 3 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2015-05-20 | mikegerwitz | Planned Release | 0.2.0 | None | |
2012-06-09 | mikegerwitz | Planned Release | None | 0.2.0 | |
2012-06-09 | mikegerwitz | Assigned to | None | mikegerwitz |
Powered by Savane 3.13-02a9.
Corresponding source code
To borrow a concept from Scala - the constructor arguments should be able to be specified with the name of the class. This will automatically assign the various arguments to their associated values to cut down on unnecessary code. The details still have to be worked out, but here's the concept. The following code:
Class( 'Foo',
{
'private _a': null,
'private _b': null,
__construct: function( a, b )
{
this._a = a;
this._b = b;
},
} );
could be more concisely written as:
Class( 'Foo', '_a', '_b', { ... } );
Or:
Class( 'Foo' )( '_a', '_b', { ... } );
Or:
Class( 'Foo' )( '_a', '_b' )( { ... } );
Syntax to be decided.
To enforce encapsulation, all properties declared in this manner should be implicitly private.