[Sugar-devel] status of "adding up to 10"?

Tomeu Vizoso tomeu at sugarlabs.org
Fri Jul 24 06:17:21 EDT 2009


On Thu, Jul 23, 2009 at 14:20, Lucian Branescu<lucian.branescu at gmail.com> wrote:
> Crockford doesn't like it because if you forget to put new for a class
> declaration that otherwise needs it, all the attributes in the class
> are set on the global namespace. Hence, dangerous to forget.
>
> He suggests using factory functions, that create and return objects instead.

Are there static analysis tools such as pylint for JS? Might help
catching up these situations.

Regards,

Tomeu

> Either way is fine, as long as your framework code is non-invasive.
>
> 2009/7/23 Bryan Berry <bryan at olenepal.org>:
>> it is fine w/ me
>>
>> I can't remember exactly why crockford doesn't like it
>>
>> On Wed, 2009-07-22 at 22:37 -0500, Felipe López Toledo wrote:
>>> Hi.
>>>
>>> I know, you've been playing around JS, maybe you have noticed about
>>> the *new* reserved word and its role.
>>> according to "Douglas Crockford, JavaScript: The Good Parts", "new" is
>>> dangerous (I'm agree) and the "Use of this style of constructor
>>> functions is not recommended".
>>>
>>> others, like "Jhon Resig, Pro JavaScript Techniques" just use it.
>>>
>>> I have found it's really normal to use "new" with JS (prototypal
>>> inheritance), so I'm using it. If someone wants me to change it. It's
>>> a really good moment to raise the hand.
>>>
>>> example:
>>> var p=new Point(1,2);
>>>
>>> also, the OOP style exists "getters" and "setters".
>>> var xval = p.getX( )
>>> p.setX( 2 );
>>>
>>> I prefer
>>> var xval = p.x;
>>> p.x = 2;
>>>
>>> jQuery works in the second way (or at least it's closer)
>>>
>>> felipe
>>> 2009/7/22 Felipe López Toledo <zer.subzero at gmail.com>
>>>         working on
>>>
>>>         I think you're going to present "karma", so I'm coding the
>>>         plugin:
>>>         jquery.karma.js
>>>
>>>
>>>         2009/7/22 Bryan Berry <bryan at olenepal.org>
>>>
>>>
>>>                 hey dude, what is the status?
>>>
>>>                 --
>>>                 Bryan W. Berry
>>>                 Technology Director
>>>                 OLE Nepal, http://www.olenepal.org
>>>
>>>
>>>
>> --
>> Bryan W. Berry
>> Technology Director
>> OLE Nepal, http://www.olenepal.org
>>
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>


More information about the Sugar-devel mailing list