Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

jslint_com · This group has moved to Google Plus.

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 584
  • Category: JavaScript
  • Founded: Mar 7, 2008
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 1624 - 1653 of 3202   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#1624 From: "abyssoft@..." <abyssoft@...>
Date: Sun Nov 21, 2010 11:20 pm
Subject: problems with Nesting
abyssoft...
Send Email Send Email
 
given the following snippet where » are tabs (4 space) and ---------- are begin
and end markers. (the blank line after the start marker is intentional)

----------

"use strict";
//Library (Netsuite Objects)
/*global NlobjAssistant, NlobjAssistantStep, NlobjButton, NlobjColumn,
NlobjConfiguration, NlobjContext, NlobjError, NlobjField, NlobjFieldGroup,
NlobjFile, NlobjForm, NlobjList, NlobjPortlet, NlobjRecord, NlobjRecord,
NlobjRequest, NlobjResponse, NlobjSearchColumn, NlobjSearchFilter,
NlobjSearchResult, NlobjSelectOption, NlobjSubList, NlobjTab
*/
//Library (Netsuite API)
/*global nlapiSearchRecord
*/
//Library (IS_library_V2_00)
/*global Global
*/
var searchResults = nlapiSearchRecord(
»'customrecord_is_module_codes',
»null,
»[
»»new NlobjSearchFilter(
»»»'internalid',
»»»null,
»»»"noneof",
»»»[
»»»»29,
»»»»31,
»»»»32,
»»»»33
»»»]
»»)
»]
);
----------

JSLint responds with a rather unexpected error

Problem at line 27 character 5: Expected ']' to have an indentation at 9 instead
at 5.

Any insight as to whether this is a bug, or am I missing something?

#1625 From: Erik Eckhardt <erik@...>
Date: Mon Nov 22, 2010 1:41 am
Subject: Re: [jslint] Re: Filtered for...in
vorpalmage
Send Email Send Email
 
*Edward*,

You are right that votes don't make something right. It is also true that
when we are talking in the area of style, the opinion of a great quantity
professionals (or at least nontrivial enthusiasts) is of some weight. And
that you deleted your Stack Overflow account in late spring doesn't mean you
are right, either. :)

>> Since you are not wanting to exit the loop it would make more sense to
plan around that condition where you do exit prematurely thereby negating
the use of continue.

This makes no sense. I don't want to *terminate* the loop (that would be
"break"). I want to go to the next invocation/cycle/loop. Why should I plan
around exiting prematurely when I don't want to do so?

*Chris Nielsen*,

>> Given the potential issues with "continue," I am not convinced that
JSLint should suggest its use, particularly when the current solution
functions perfectly well.

I am completely with you about not *suggesting* the use of 'continue'. No
one said anything about that. Instead, I asked for it to be *allowed*.

Detecting that a 'continue' does in fact filter a for...in loop is far from
promoting its use. The decision to not complain about continue was made on
jslint some time ago. Until that decision is changed, why penalize for it?
And if the decision IS changed, and the warning against the use of
'continue' is given its own option to turn it off, we'd still be in the same
position of getting an error about unfiltered for...in even though warnings
on 'continue' have been suppressed. That means to me that jslint is broken.

Filtering and the use of 'continue' are two completely separate issues. If
someone doesn't like continue, great. But for cryin' out loud, it DOES
filter a for...in loop!

>> I am happy to avoid use of "continue" unless it offers a clear
improvement. I don't see such an improvement in this case.

If you wish to avoid it, more power to you. But you also said that you agree
it's purely a stylistic consideration. Given that even though you don't
personally see a clear improvement, I do see one, so what is the harm in
allowing me my preference?

Programmers sure are an opinionated bunch (not excluding self)!

Erik

On Fri, Nov 19, 2010 at 1:00 PM, Cheney, Edward A SSG RES USAR USARC <
austin.cheney@...> wrote:

>
>
> Erik,
>
>
> > In my opinion this is little different than this greatly-upvoted Stack
> > Overflow
>
> I deleted my Stack Overflow account in late spring. Popularity is not a
> correlation to accuracy.
>
>
> > The top 533 votes on the 3-most-upvoted answers all weigh in that they
> > think the "one return per procedure" rule is, well, stupid.
>
> There is nothing wrong with multiple exit points from a container of
> logic. If you have all that you need then destroy the current loop and
> exit the current container as early as possible. This is the only way I
> could make my markup beautification logic perform in an acceptable time
> frame.
>
>
> > I think this is one of those cases: I don't want to exit the loop, I
> > don't want a huge if block polluting my function, I just want to
> > quickly go to the next loop if the circumstances for this invocation
> > are wrong.
>
> The point of the continue statement is to break the current index of a
> loop provided a condition without breaking from the loop. Since you are
> not wanting to exist the loop it would make more sense to plan around
> that condition where you do exit prematurely thereby negating the use of
> continue.
>
>
> Austin Cheney, CISSP
> http://prettydiff.com/
>
>


[Non-text portions of this message have been removed]

#1626 From: "Jakob Kruse" <kruse@...>
Date: Mon Nov 22, 2010 7:15 am
Subject: SV: [jslint] problems with Nesting
thekrucible
Send Email Send Email
 
JSLint (with the strict whitespace option) does not support the way you write an
array. Specifically it does support a line break after a comma, but not between
the last array element and the end brace. This leads to the “wrong indentation”
error.

/Jakob


Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af
abyssoft@...
Sendt: 22. november 2010 00:20
Til: jslint_com@yahoogroups.com
Emne: [jslint] problems with Nesting


given the following snippet where » are tabs (4 space) and ---------- are begin
and end markers. (the blank line after the start marker is intentional)

----------

"use strict";
//Library (Netsuite Objects)
/*global NlobjAssistant, NlobjAssistantStep, NlobjButton, NlobjColumn,
NlobjConfiguration, NlobjContext, NlobjError, NlobjField, NlobjFieldGroup,
NlobjFile, NlobjForm, NlobjList, NlobjPortlet, NlobjRecord, NlobjRecord,
NlobjRequest, NlobjResponse, NlobjSearchColumn, NlobjSearchFilter,
NlobjSearchResult, NlobjSelectOption, NlobjSubList, NlobjTab
*/
//Library (Netsuite API)
/*global nlapiSearchRecord
*/
//Library (IS_library_V2_00)
/*global Global
*/
var searchResults = nlapiSearchRecord(
»'customrecord_is_module_codes',
»null,
»[
»»new NlobjSearchFilter(
»»»'internalid',
»»»null,
»»»"noneof",
»»»[
»»»»29,
»»»»31,
»»»»32,
»»»»33
»»»]
»»)
»]
);
----------

JSLint responds with a rather unexpected error

Problem at line 27 character 5: Expected ']' to have an indentation at 9 instead
at 5.

Any insight as to whether this is a bug, or am I missing something?


[Non-text portions of this message have been removed]

#1627 From: "abyssoft@..." <abyssoft@...>
Date: Mon Nov 22, 2010 7:30 am
Subject: Re: SV: [jslint] problems with Nesting
abyssoft...
Send Email Send Email
 
It would be nice if this was supported as it provides good clarity.
Any others who would like to weight in?

--- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@...> wrote:
>
> JSLint (with the strict whitespace option) does not support the way you write
an array. Specifically it does support a line break after a comma, but not
between the last array element and the end brace. This leads to the "wrong
indentation" error.
>
> /Jakob
>
>

#1628 From: "abyssoft@..." <abyssoft@...>
Date: Mon Nov 22, 2010 2:43 pm
Subject: Re: SV: [jslint] problems with Nesting
abyssoft...
Send Email Send Email
 
I decided to test your assertion, simplified the test and the result was not as
expected given the assertion. The code below did not throw the error, yet uses
the same formatting. So I'm starting to lean toward either throwing the error is
a bug or the not throwing the error is a bug, as there should be consistency. As
stated previously, my opinion is that the thrown error is the bug.

----------

"use strict";
var servicesClasses = [
»"8",
»"15",
»"30"
];

----------

--- In jslint_com@yahoogroups.com, "Jakob Kruse" <kruse@...> wrote:
>
> JSLint (with the strict whitespace option) does not support the way you write
an array. Specifically it does support a line break after a comma, but not
between the last array element and the end brace. This leads to the "wrong
indentation" error.
>
> /Jakob
>
>
> Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne
af abyssoft@...
> Sendt: 22. november 2010 00:20
> Til: jslint_com@yahoogroups.com
> Emne: [jslint] problems with Nesting
>
>
> given the following snippet where » are tabs (4 space) and ---------- are
begin and end markers. (the blank line after the start marker is intentional)
>
> ----------
>
> "use strict";
> //Library (Netsuite Objects)
> /*global NlobjAssistant, NlobjAssistantStep, NlobjButton, NlobjColumn,
NlobjConfiguration, NlobjContext, NlobjError, NlobjField, NlobjFieldGroup,
NlobjFile, NlobjForm, NlobjList, NlobjPortlet, NlobjRecord, NlobjRecord,
NlobjRequest, NlobjResponse, NlobjSearchColumn, NlobjSearchFilter,
NlobjSearchResult, NlobjSelectOption, NlobjSubList, NlobjTab
> */
> //Library (Netsuite API)
> /*global nlapiSearchRecord
> */
> //Library (IS_library_V2_00)
> /*global Global
> */
> var searchResults = nlapiSearchRecord(
> »'customrecord_is_module_codes',
> »null,
> »[
> »»new NlobjSearchFilter(
> »»»'internalid',
> »»»null,
> »»»"noneof",
> »»»[
> »»»»29,
> »»»»31,
> »»»»32,
> »»»»33
> »»»]
> »»)
> »]
> );
> ----------
>
> JSLint responds with a rather unexpected error
>
> Problem at line 27 character 5: Expected ']' to have an indentation at 9
instead at 5.
>
> Any insight as to whether this is a bug, or am I missing something?
>
>
> [Non-text portions of this message have been removed]
>

#1629 From: "James" <jacob@...>
Date: Wed Nov 24, 2010 2:44 pm
Subject: Cascade format
jpdavenportjr
Send Email Send Email
 
In "JavaScript: The Good Parts", page 42, a cascade is formatted very nicely. 
In my example, I have:

var htmlToExamine = returnvalue.
	 replace(/^Success/, "").
	 replace(/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/, "").
	 replace(/<script.*?<\/script>/g, "").
	 replace(/^\s*<[^>]+>\s*/, "").
	 replace(/\s*<\/\w+>\s*$/, "");

I like how this looks, lining up the replace method calls.  However, JSLint does
not like it.  Is there an option I'm missing that lets this format be accepted?

#1630 From: "Rob Richardson" <erobrich@...>
Date: Wed Nov 24, 2010 3:25 pm
Subject: RE: [jslint] Cascade format
erobrich@...
Send Email Send Email
 
Put the dots at the beginning of the next line rather than at the end of the
former line.

Rob


-----Original Message-----
From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
Behalf Of James
Sent: Wednesday, November 24, 2010 7:45 AM
To: jslint_com@yahoogroups.com
Subject: [jslint] Cascade format

In "JavaScript: The Good Parts", page 42, a cascade is formatted very
nicely.  In my example, I have:

var htmlToExamine = returnvalue.
	 replace(/^Success/, "").
	 replace(/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/, "").
	 replace(/<script.*?<\/script>/g, "").
	 replace(/^\s*<[^>]+>\s*/, "").
	 replace(/\s*<\/\w+>\s*$/, "");

I like how this looks, lining up the replace method calls.  However, JSLint
does not like it.  Is there an option I'm missing that lets this format be
accepted?

#1631 From: Frederik Dohr <fdg001@...>
Date: Wed Nov 24, 2010 3:29 pm
Subject: Re: [jslint] Cascade format
ace_noone
Send Email Send Email
 
> Put the dots at the beginning of the next line rather than at the end of the
> former line.

Rationale:
http://tech.groups.yahoo.com/group/jslint_com/message/1448
http://tech.groups.yahoo.com/group/jslint_com/message/1455

Unfortunately, there's no option I believe.


-- F.

#1632 From: "abyssoft@..." <abyssoft@...>
Date: Wed Nov 24, 2010 3:51 pm
Subject: Re: [jslint] Cascade format
abyssoft...
Send Email Send Email
 
Typically for me, while it does introduce extra parentheses and increases the
number of lines in my raw code it does lend itself to better readability, I
would format the code snippet as : where » is a tab of 4 spaces ; and it passes
lint validation when using the following leader lines.

/*jslint white: true, browser: true, devel: true, windows: true, sub: true,
undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp:
false, immed: true, strict: false*/
/*global returnvalue */

var htmlToExamine = (
»returnvalue
»».replace(
»»»/^Success/,
»»»""
»»)
»».replace(
»»»/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/,
»»»""
»»)
»».replace(
»»»/<script.*?<\/script>/g,
»»»""
»»)
»».replace(
»»»/^\s*<[^>]+>\s*/,
»»»""
»»)
»».replace(
»»»/\s*<\/\w+>\s*$/,
»»»""
»»)
);

#1633 From: Tzvika <tzvikam@...>
Date: Wed Nov 24, 2010 4:48 pm
Subject: Re: [jslint] Cascade format
btm004
Send Email Send Email
 
Rob

But due to 'semicolon insertion', you will get an error on line 2.


On Wed, Nov 24, 2010 at 5:25 PM, Rob Richardson <erobrich@...>wrote:

>
>
> Put the dots at the beginning of the next line rather than at the end of
> the
> former line.
>
> Rob
>
>
> -----Original Message-----
> From: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com> [mailto:
> jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>] On
> Behalf Of James
> Sent: Wednesday, November 24, 2010 7:45 AM
> To: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>
> Subject: [jslint] Cascade format
>
> In "JavaScript: The Good Parts", page 42, a cascade is formatted very
> nicely. In my example, I have:
>
> var htmlToExamine = returnvalue.
> replace(/^Success/, "").
> replace(/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/, "").
> replace(/<script.*?<\/script>/g, "").
> replace(/^\s*<[^>]+>\s*/, "").
> replace(/\s*<\/\w+>\s*$/, "");
>
> I like how this looks, lining up the replace method calls. However, JSLint
> does not like it. Is there an option I'm missing that lets this format be
> accepted?
>
>
>



--

Tzvika Merchav


Tel: +972-57-5659548
www.listen.co.il


[Non-text portions of this message have been removed]

#1634 From: Erik Eckhardt <erik@...>
Date: Wed Nov 24, 2010 5:09 pm
Subject: Re: [jslint] Cascade format
vorpalmage
Send Email Send Email
 
Rob already answered to put the periods on the next line, but I wanted to
point out a potential problem in your regular expressions.

The following block could end up being completely removed (depending on
whether your regex engine is being greedy or not) because your script
removal expression uses .* which can scream right past any opening and
closing tags in between.

<script type="text/javascript">function f() {}</script>
<strong>VERY IMPORTANT HTML CONTENT HERE</strong>
<script type="text/javascript">function g() {}</script>

On Wed, Nov 24, 2010 at 6:44 AM, James <jacob@...> wrote:

>
>
> In "JavaScript: The Good Parts", page 42, a cascade is formatted very
> nicely. In my example, I have:
>
> var htmlToExamine = returnvalue.
> replace(/^Success/, "").
> replace(/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/, "").
> replace(/<script.*?<\/script>/g, "").
> replace(/^\s*<[^>]+>\s*/, "").
> replace(/\s*<\/\w+>\s*$/, "");
>
> I like how this looks, lining up the replace method calls. However, JSLint
> does not like it. Is there an option I'm missing that lets this format be
> accepted?
>
>
>


[Non-text portions of this message have been removed]

#1635 From: Erik Eckhardt <erik@...>
Date: Wed Nov 24, 2010 6:19 pm
Subject: Re: [jslint] Cascade format
vorpalmage
Send Email Send Email
 
I don't think that's true... I have code with dots on the next line and I
don't think jslint complains about it.

On Wed, Nov 24, 2010 at 8:48 AM, Tzvika <tzvikam@...> wrote:

>   Rob
>
> But due to 'semicolon insertion', you will get an error on line 2.
>
> On Wed, Nov 24, 2010 at 5:25 PM, Rob Richardson
<erobrich@...<erobrich%40robrich.org>
> >wrote:
> > Put the dots at the beginning of the next line rather than at the end of
> > the
> > former line.
> >
> > Rob
> >
> > -----Original Message-----
> > From: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com><jslint_com%
> 40yahoogroups.com> [mailto:
> > jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com> <jslint_com%
> 40yahoogroups.com>] On
> > Behalf Of James
> > Sent: Wednesday, November 24, 2010 7:45 AM
> > To: jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com><jslint_com%
> 40yahoogroups.com>
> > Subject: [jslint] Cascade format
> >
> > In "JavaScript: The Good Parts", page 42, a cascade is formatted very
> > nicely. In my example, I have:
> >
> > var htmlToExamine = returnvalue.
> > replace(/^Success/, "").
> > replace(/^<div id="\w+_table_\d+_book_buttons".*?<\/div>/, "").
> > replace(/<script.*?<\/script>/g, "").
> > replace(/^\s*<[^>]+>\s*/, "").
> > replace(/\s*<\/\w+>\s*$/, "");
> >
> > I like how this looks, lining up the replace method calls. However,
> JSLint
> > does not like it. Is there an option I'm missing that lets this format be
> > accepted?
>
> Tzvika Merchav
>


[Non-text portions of this message have been removed]

#1636 From: "Douglas Crockford" <douglas@...>
Date: Sun Nov 28, 2010 1:18 pm
Subject: JSLint Database
douglascrock...
Send Email Send Email
 
I want to create a small database collecting all of the ways people have found
to run JSLint. You have developed various ways of running it from command lines,
in widgets, in editors and IDEs, and in servers. I would like to collect them
all.

So please look at
http://tech.groups.yahoo.com/group/jslint_com/database?method=reportRows&tbl=1

If you have a method of usage that is not in the table, then please add a record
that describes it.

I am dropping support for rhino.js and wsh.js because others have improved on
them. If you have such an improvement, please add a record describing it.

Thank you.

#1637 From: Mark Volkmann <r.mark.volkmann@...>
Date: Sun Nov 28, 2010 7:09 pm
Subject: Re: [jslint] JSLint Database
mark_volkmann
Send Email Send Email
 
On Sun, Nov 28, 2010 at 7:18 AM, Douglas Crockford <douglas@...>wrote:

>
>
> I am dropping support for rhino.js and wsh.js because others have improved
> on them. If you have such an improvement, please add a record describing it.
>
Can you tell us the location(s) of improved versions of Rhino support? My
googling hasn't turned up any yet.

--
R. Mark Volkmann
Object Computing, Inc.


[Non-text portions of this message have been removed]

#1638 From: Dominic Mitchell <dom@...>
Date: Sun Nov 28, 2010 9:06 pm
Subject: Re: [jslint] JSLint Database
happygiraffe...
Send Email Send Email
 
On Sun, Nov 28, 2010 at 7:09 PM, Mark Volkmann <r.mark.volkmann@...>wrote:

> On Sun, Nov 28, 2010 at 7:18 AM, Douglas Crockford <douglas@...
> >wrote:
>
> >
> >
> > I am dropping support for rhino.js and wsh.js because others have
> improved
> > on them. If you have such an improvement, please add a record describing
> it.
> >
> Can you tell us the location(s) of improved versions of Rhino support? My
> googling hasn't turned up any yet.
>

I don't know if there's totally general rhino support, but my wrapper,
jslint4java <http://code.google.com/p/jslint4java/>, covers a few use cases
(cli and ant build).

-Dom


[Non-text portions of this message have been removed]

#1639 From: "MikeHatfield" <mikehatfield@...>
Date: Mon Nov 29, 2010 12:43 pm
Subject: JSLint.com is down
MikeHatfield
Send Email Send Email
 
I'm sure most people are aware of this by now... seems to be due to a missing
"widget.js" file.

Cheers,
Mike

#1640 From: Douglas Crockford <douglas@...>
Date: Mon Nov 29, 2010 1:00 pm
Subject: Re: [jslint] JSLint.com is down
douglascrock...
Send Email Send Email
 
Thanks. There was a file transfer error. Please try it now.

#1641 From: "Douglas Crockford" <douglas@...>
Date: Mon Nov 29, 2010 1:15 pm
Subject: new Array(3)
douglascrock...
Send Email Send Email
 
JSLint allows new Array(3), but warns on new Array(3, 4) and new Array("3").

Someone wrote to me that they were confused by that. He was confused because he
thought new Array(3) meant [3].

So, because of that confusion, I think new Array(3) should get a warning as
well.

Comments?

#1642 From: Morgaut Alexandre Louis Marc <morgaut@...>
Date: Mon Nov 29, 2010 1:44 pm
Subject: Re: [jslint] new Array(3)
morgaut_a
Send Email Send Email
 
Could this be resolved by providing a more explicit warning message on new
Array() ?

Kind of:
  "new Array() only acceptable to fix the size of a new empty Array. Use the
literal notation to provide non-empty arrays"


On Nov 29, 2010, at 2:15 PM, Douglas Crockford wrote:

> JSLint allows new Array(3), but warns on new Array(3, 4) and new Array("3").
>
> Someone wrote to me that they were confused by that. He was confused because
he thought new Array(3) meant [3].
>
> So, because of that confusion, I think new Array(3) should get a warning as
well.
>
> Comments?
>
>



[Non-text portions of this message have been removed]

#1643 From: "MikeHatfield" <mikehatfield@...>
Date: Mon Nov 29, 2010 2:04 pm
Subject: Re: [jslint] JSLint.com is down
MikeHatfield
Send Email Send Email
 
All good now - thanks for the quick turnaround for this invaluable resource
Douglas.

Mike

#1644 From: "Rob Richardson" <erobrich@...>
Date: Mon Nov 29, 2010 5:06 pm
Subject: RE: [jslint] JSLint Database
erobrich@...
Send Email Send Email
 
Is this information available in another form or is there a trick to getting
to it without a Yahoo account?  My address subscribed to this list isn't a
Yahoo account (as it doesn't end in @yahoo.com), so I'm having difficulty
reaching the online portion of this group, and thus the database.

Rob


-----Original Message-----
From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
Behalf Of Douglas Crockford
Sent: Sunday, November 28, 2010 6:18 AM
To: jslint_com@yahoogroups.com
Subject: [jslint] JSLint Database

I want to create a small database collecting all of the ways people have
found to run JSLint. You have developed various ways of running it from
command lines, in widgets, in editors and IDEs, and in servers. I would like
to collect them all.

So please look at
http://tech.groups.yahoo.com/group/jslint_com/database?method=reportRows&tbl
=1

If you have a method of usage that is not in the table, then please add a
record that describes it.

I am dropping support for rhino.js and wsh.js because others have improved
on them. If you have such an improvement, please add a record describing it.

Thank you.

#1645 From: "Jakob Kruse" <kruse@...>
Date: Mon Nov 29, 2010 5:59 pm
Subject: SV: [jslint] JSLint Database
thekrucible
Send Email Send Email
 
My guess would be ”no”, but I’m no authority on the matter. I will add on behalf
of a friend who has likewise been unable to access the group for more than a
year that Yahoo support on this problem seems to be non-existent. Good luck
getting access, and please let us know if you pull it off (without subscribing a
new address).

/Jakob


Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af
Rob Richardson
Sendt: 29. november 2010 18:07
Til: jslint_com@yahoogroups.com
Emne: RE: [jslint] JSLint Database


Is this information available in another form or is there a trick to getting
to it without a Yahoo account? My address subscribed to this list isn't a
Yahoo account (as it doesn't end in @yahoo.com), so I'm having difficulty
reaching the online portion of this group, and thus the database.

Rob

-----Original Message-----
From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
Behalf Of Douglas Crockford
Sent: Sunday, November 28, 2010 6:18 AM
To: jslint_com@yahoogroups.com
Subject: [jslint] JSLint Database

I want to create a small database collecting all of the ways people have
found to run JSLint. You have developed various ways of running it from
command lines, in widgets, in editors and IDEs, and in servers. I would like
to collect them all.

So please look at
http://tech.groups.yahoo.com/group/jslint_com/database?method=reportRows&tbl
=1

If you have a method of usage that is not in the table, then please add a
record that describes it.

I am dropping support for rhino.js and wsh.js because others have improved
on them. If you have such an improvement, please add a record describing it.

Thank you.


[Non-text portions of this message have been removed]

#1646 From: "Jordan" <ljharb@...>
Date: Mon Nov 29, 2010 8:21 pm
Subject: Re: new Array(3)
ljharb
Send Email Send Email
 
The only uses I can see out of even allowing the "new Array" syntax at ALL are:
1) allocating memory for an array before you put items into it (not really
applicable to Javascript)
2) pre-populating an array to a fixed length with `undefined` - basically
removing the usefulness of the Array.length property.

Can anyone provide a use case (one that's actually being used in production
code, and not just an academic exercise) in Javascript where using the array
literal syntax doesn't provide what you need?

- Jordan

--- In jslint_com@yahoogroups.com, Morgaut Alexandre Louis Marc <morgaut@...>
wrote:
>
> Could this be resolved by providing a more explicit warning message on new
Array() ?
>
> Kind of:
>  "new Array() only acceptable to fix the size of a new empty Array. Use the
literal notation to provide non-empty arrays"
>
>
> On Nov 29, 2010, at 2:15 PM, Douglas Crockford wrote:
>
> > JSLint allows new Array(3), but warns on new Array(3, 4) and new Array("3").
> >
> > Someone wrote to me that they were confused by that. He was confused because
he thought new Array(3) meant [3].
> >
> > So, because of that confusion, I think new Array(3) should get a warning as
well.
> >
> > Comments?
> >
> >
>
>
>
> [Non-text portions of this message have been removed]
>

#1647 From: Marcel Duran <contact@...>
Date: Mon Nov 29, 2010 8:48 pm
Subject: Re: [jslint] Re: new Array(3)
marcelduran
Send Email Send Email
 
>
>
> Can anyone provide a use case (one that's actually being used in production
> code, and not just an academic exercise) in Javascript where using the array
> literal syntax doesn't provide what you need?
>
> new Array(n + 1).join('*'); // string containing n asterisks
source: http://tech.groups.yahoo.com/group/jslint_com/message/598


[Non-text portions of this message have been removed]

#1648 From: "abyssoft@..." <abyssoft@...>
Date: Mon Nov 29, 2010 10:58 pm
Subject: [jslint] Re: new Array(3)
abyssoft...
Send Email Send Email
 
--- In jslint_com@yahoogroups.com, Marcel Duran <contact@...> wrote:
>
> >
> >
> > Can anyone provide a use case (one that's actually being used in production
> > code, and not just an academic exercise) in Javascript where using the array
> > literal syntax doesn't provide what you need?
> >
> > new Array(n + 1).join('*'); // string containing n asterisks
> source: http://tech.groups.yahoo.com/group/jslint_com/message/598
>
>
> [Non-text portions of this message have been removed]
>

http://tech.groups.yahoo.com/group/jslint_com/message/614

Provides an elegant & effective solution without the use of new Array(n+1) and
it operates quickly in all modern browsers.

#1649 From: Marcel Duran <contact@...>
Date: Tue Nov 30, 2010 10:56 am
Subject: Re: [jslint] Re: new Array(3)
marcelduran
Send Email Send Email
 
>
>
> http://tech.groups.yahoo.com/group/jslint_com/message/614
>
> Provides an elegant & effective solution without the use of new Array(n+1)
> and it operates quickly in all modern browsers.
>
> I've just made a JSPerf benchmark comparing these various ways of creating
a string of n repeated character:

http://jsperf.com/string-of-n-character

Seems like new Array and [].length are the slowest ones at least in latest
version of Chrome. Feel free to run this test in different browsers and let
browserscope take care of benchmark results.

Marcel


[Non-text portions of this message have been removed]

#1650 From: "Jakob Kruse" <kruse@...>
Date: Tue Nov 30, 2010 11:34 am
Subject: SV: [jslint] Re: new Array(3)
thekrucible
Send Email Send Email
 
Actually, it seems you made some errors in a couple of the tests that could
invalidate the results. In ‘array literal joining char’ and ‘array literal
.length property’ you use a string instead of the char variable for your joins.

/Jakob


Fra: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] På vegne af
Marcel Duran
Sendt: 30. november 2010 11:56
Til: jslint_com@yahoogroups.com
Emne: Re: [jslint] Re: new Array(3)


>
>
> http://tech.groups.yahoo.com/group/jslint_com/message/614
>
> Provides an elegant & effective solution without the use of new Array(n+1)
> and it operates quickly in all modern browsers.
>
> I've just made a JSPerf benchmark comparing these various ways of creating
a string of n repeated character:

http://jsperf.com/string-of-n-character

Seems like new Array and [].length are the slowest ones at least in latest
version of Chrome. Feel free to run this test in different browsers and let
browserscope take care of benchmark results.

Marcel

[Non-text portions of this message have been removed]


[Non-text portions of this message have been removed]

#1651 From: Morgaut Alexandre Louis Marc <morgaut@...>
Date: Tue Nov 30, 2010 11:36 am
Subject: Re: [jslint] Re: new Array(3)
morgaut_a
Send Email Send Email
 
Very interesting test :-)

thanx jsperf ;-)

but there was some errors...
To be comparable, in those scripts
str = a.join('char');
and
str = a.join('*');
should be
str = a.join(char);



Please note also that priority must not be always focused on perf

These must also be considered:
  - Readability of the code
  - Less code === Less potential error hidden in the pattern (wrong copy/paste or
error while typing)

So I may be  more confident to see these powerful patterns only where they are
required
(maybe even with a comment to improve the readability)

About these two readable solutions, the use of "new Array(n)" vs "a.length = n"
I still prefer the first one...

here:

var tmpArray, myString;

tmpArray = [];
tmpArray.length = 20;
myString = tmpArray.join('*');

-> The initialisation of my string variable require to use a temporary variable
which will pollute my scope when debugging

there

var myString;

myString = [];
myString.length = 20;
myString = myString('*');

-> myString is first an array (arghhh) before becoming the desired string... and
still multiple lines for simple initialisation

finally

var myString = new Array(10).join('*');

-> The initialisation is on one line only and directly provide the good type


On Nov 30, 2010, at 11:56 AM, Marcel Duran wrote:

> >
> >
> > http://tech.groups.yahoo.com/group/jslint_com/message/614
> >
> > Provides an elegant & effective solution without the use of new Array(n+1)
> > and it operates quickly in all modern browsers.
> >
> > I've just made a JSPerf benchmark comparing these various ways of creating
> a string of n repeated character:
>
> http://jsperf.com/string-of-n-character
>
> Seems like new Array and [].length are the slowest ones at least in latest
> version of Chrome. Feel free to run this test in different browsers and let
> browserscope take care of benchmark results.
>
> Marcel
>
> [Non-text portions of this message have been removed]
>
>



[Non-text portions of this message have been removed]

#1652 From: "Douglas Crockford" <douglas@...>
Date: Tue Nov 30, 2010 12:03 pm
Subject: [jslint] Re: new Array(3)
douglascrock...
Send Email Send Email
 
--- In jslint_com@yahoogroups.com, Morgaut Alexandre Louis Marc <morgaut@...>
wrote:
> Please note also that priority must not be always focused on perf
>
> These must also be considered:
>  - Readability of the code
>  - Less code === Less potential error hidden in the pattern (wrong copy/paste
or error while typing)

Readability is paramount. So the inherent off-by-one problem in the trick makes
it hazardous. Certainly it does not justify keeping new Array in the safe
subset. The fact that new Array(3) is not the same as [3] is a more serious
problem than the need to make a string with the wrong number of stars in it.

Is there another essential use for new Array?

#1653 From: Marcel Duran <contact@...>
Date: Tue Nov 30, 2010 1:35 pm
Subject: Re: [jslint] Re: new Array(3)
marcelduran
Send Email Send Email
 
I've just fixed the test problems, thanks all for detecting these errors.
FYI, JSPerf allows anyone to edit any test by appending /edit to the url
test, so you can fix/add more tests for new revisions.

http://jsperf.com/string-of-n-character

Marcel


[Non-text portions of this message have been removed]

Messages 1624 - 1653 of 3202   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help