array question

A

Anthony Jones

Dave Anderson said:
I do not agree. If you have a problem with syntax, then you are likely to be
posting here for the first time (or thereabout). This forum was not already
"your community" because you would have been reading it for some time, and
would know the difference between microsoft.public.scripting.vbscript and
microsoft.public.inetserver.asp.general. If it were "your community", you
would have an interest in keeping it tidy.

Nah, I like the idea of people who doing similar things talking to each
other in same place about the various things they have to do. You're right
of course it would keep things tidy.
By that reasoning, none of these are justified:

JavaScript is not Java
ASP.NET is not ASP
Client-side is not server-side
(D)HTML is not ASP

Yep right again.
My point, if you read it carefully, is that the rebuke need not be rude, and
ought to be instructive. There *is* value in asking people to use
appropriate groups.

Within reason but a purely VBScript question is IMO appropriately asked
here. Whether it's right or wrong and whether you like it or not the NGs
_have_ become communities of people doing similar things. The original
technical sectioning of the NGs has been usurped by the what those technical
things are generally used for.
The last thng we need is a bunch of posts about the
conflict Lebanon.




Who complained? I advocated instructive examples that make the point.

Ok compliant was too strong a word. I don't even think it makes sense to
try to encourage someone to use what is technically the correct group if the
question is reasonable relevant to the community. An ASPer can take a one
look at the set of subjects in VBscript and reasonable conclude they are in
the wrong place.
I can't agree that JScript is more powerful than VBScript. I cannot think of
a single task that JScript can solve, but that VBScript cannot.

Well that statement is true for pretty much anything that can assign
variables and branch. It's a matter of how quickly you can build the code
and how understandable it is when you've built it.
 
D

Dave Anderson

Evertjan. said:
var a = new Array();
a[0] = 5;
a[999] = 'Hi';
response.write(a.length+'<br>') // writes 1000
a['saved'] = 4;
response.write(a.length) // writes 1000 again

I think length does not return the actual number of terms,
so a count is necessary:

ECMA-262v3, 15.4.5.2 length
The length property of this Array object is always
numerically greater than the name of every property
whose name is an array index.
 
E

Evertjan.

Dave Anderson wrote on 11 aug 2006 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
var a = new Array();
a[0] = 5;
a[999] = 'Hi';
response.write(a.length+'<br>') // writes 1000
a['saved'] = 4;
response.write(a.length) // writes 1000 again

I think length does not return the actual number of terms,
so a count is necessary:

ECMA-262v3, 15.4.5.2 length
The length property of this Array object is always
numerically greater than the name of every property
whose name is an array index.

Sorry, I do not understand this ECMA sentence.

A property is a value? Or has a value?

How can something be greater than the name?
[Meaning no insult to the Jewish faith]

Wat would be the name of the length property? "length"?

Is a name not an array index if it is enumerated?

What where thos ECMA boys and girls doing
the day they concocted this ruling?

Anyway, I thought we were talking JScript? ;-)
 
D

Dave Anderson

Bob said:
Wait a minute, you seem to be implying that vbscript or
jscript syntax questions are not really on-topic here.
Am I reading too much into this statement?

I think so. I don't personally mind that questions are off-topic when they
are clearly *related* to ASP. I think it is often reasonable to ask ADO,
CDO, SQL, VBScript, JScript, DOM and HTML questions here. You can observe
for yourself that I answer questions on a broad range of topics.

I intended to say that posters should be made aware when their questions are
unnecessarily vague[1]. It is in their interests to narrow their questions,
after all.

Your observation to Anthony echoes my belief. People SHOULD be taught to use
correct terminology. Some of us are just less personable in our writing
style.




[1] "Rebuke" was a poor word choice -- a bit harsher to read than I
intended. It is no help that communicating in plain text adds to the
perception of pointless pedantry on my part.
 
D

Dave Anderson

Evertjan. said:
Sorry, I do not understand this ECMA sentence.

It means that when you enumerate the properties of an array object, some of
them are nonnegative integers, which are treated by the array as index
values:

a[0] = 5;
a[999] = 'Hi';
a['saved'] = 4;
for (var x in a) output(x) // "0", "999", "saved"
for (x in a) output(typeof x) // "string", "string", "string"

In this example, there is a property named "0", another named "999" and a
third named "saved". Two coerce to nonnegative integers, so they are treated
like index values.
Wat would be the name of the length property? "length"?

I assume so.


Is a name not an array index if it is enumerated?

I'm not sure what you mean here. Hopefully, my above answer clears it up.


Anyway, I thought we were talking JScript? ;-)

Forget I said anything.
 
M

Mike Brind

Evertjan. said:
Mike Brind wrote on 11 aug 2006 in
microsoft.public.inetserver.asp.general:
I _always_ assume vbscript. Users of jscript/javascript or perl tend
to announce themselves (in a tone of voice that varies between proud,
or aggressively defensive ).

[skipping a lot of following and diverging thread lines resulting from
here]

You can see the OP asked a Q that can be answered
with a vbscript answer or an jscript answer,
if the word "function" can be extended to "method",
which is a function in the broader sence too.

My one row addition, which is only a rebuke in the most suspicious of
minds, and I know Mike's mind is not, is just that _I_ would have
answered:

You're right. I didn't see it as a rebuke. I'm well used to your
style now.
"Ubound() in vbscript"

I cannot agree with Mike it is a good thing to assume vbs in an anwer
where vbs is not stipulated in the question in his ASP NG.

To be fair, there were a number of clues in this case that the OP uses
vbs, not the least of which is that his previous questions have
stipulated vbs. And as Dave Anderson pointed out, vbs was implied in
the question. Nevertheless, it isn't going to cause me any problems to
add the bit of clarification you suggest in future.
The "asp = vbscript" concept does not aggree with me.

I go back to what I said earlier. The vast majority of questioners
here use vbscript, and it is the default language. The small number of
jscript/perlscript users do tend to clarify the language they are
using. I have yet to see anyone here ask a general scripting question,
be given an answer in vbs, then announce that actually, they are using
javascript.

That explains my thought processes. Whether it is a *good* thing to
assume vbs in an question, I can't answer, but I think it is a
reasonably *safe* thing to do. Nevertheless, I see the merit in your
suggestion regarding the added clarification of language in answers in
the future.
 
D

Dave Anderson

Mike said:
I have yet to see anyone here ask a general scripting
question, be given an answer in vbs, then announce that
actually, they are using javascript.

That explains my thought processes. Whether it is a *good*
thing to assume vbs in an question, I can't answer, but I
think it is a reasonably *safe* thing to do.

It's a little bit if a chicken & egg problem, isn't it? Since Microsoft
documentation provides essentially *zero* ASP examples written in JScript,
(a) many people are unaware that JScript is an option, and (b) people
searching for JScript solutions usually announce their language.

This is further compounded by the fact that ASP/VBScript examples (whether
on msdn or elsewhere) almost always lack the details needed to do the job in
JScript. The JScript author needs to learn, for example, that these two are
equivalent:

VBScript ----
request("abc")

JScript -----
Request.QueryString("abc").Item ||
Request.Form("abc").Item ||
Request.Cookies("abc").Item ||
Request.ClientCertificates("abc").Item ||
Request.ServerVariables("abc").Item

That is a lot of conditional assignment, and the kind of knowledge that has
to be *sought*, due to the poor quality of VBScript (and by implication,
ALL) ASP examples.

All of these conspire against the individal who wants to use JScript to
write ASP. So only the determined do. It's a shame, too. I think ASP in
JScript is a marvelously flexible and powerful thing.

So yes, I agree that it is safe to assume VBScript in almost all cases.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top