I don't think

var result = value1, value2;

does what you think it does.  The intention isn't to store value1 and
value2 in result, it is to declare two separate variables in one line
and store the results of value1 into result.  Functionally the same
as:

var result = value1;
var value2;

jslint rules require doing all of your var declarations at the top of
the functions they are used in because regardless of where you declare
a variable in a function, it has scope in that entire function.  What
I mean by this is

function () {
    var foo;
    alert(foo);
}

and

function () {
    alert(foo);
    var foo;
}

are equivalent though this is not:

function () {
   alert(foo);
}

And the only way to do all of the var declarations at the top is in
the format of:
var foo, bar, foobar = 'foo', barfoo = 'bar', farboo, boofar = [];

Also, it would be very difficult to write any sort of transformation
between strictly written and syntax shortcuts, because they are not
functionally equivalent.

5 == '5'  is not the same as  5 === '5'

This created all sorts of difficulties when we moved to using jslint
standards at work.  The places that broke the most were the ones
checking for

foo == null when we were actually looking for undefined because
undefined == null but undefined !== null.

That said, I agree with your underlying premise that it would be nice
if Prototype followed jslint standards, but I have a lot of other
qualms that I would prefer figuring out first, like a way to constrain
Prototype to a certain part of my code instead of exposing all of the
global variables and prototype additions everywhere.  That effort is
already underway, and I vote for doing that first.

Josh Powell


On Mar 25, 12:57 pm, Jonathan Buhacoff <jonat...@buhacoff.net> wrote:
> Just had another thought -- it's possible to satisfy proponents of
> both strict coding and quick downloads.  Given a strictly written
> program, it's possible to write a transformation to apply all the
> syntax shortcuts to it and produce an equivalent lean version with
> minimum whitespace and punctuation.  So if this were the process,
> everyone would win.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to