Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

call by reference

59 views
Skip to first unread message

Andreas Bergmaier

unread,
Mar 23, 2012, 8:56:38 AM3/23/12
to
I know, JavaScript does not support call-by-reference. Every function
invocation does call-by-value, even if that value is a reference value
to an array-/function-/plain-Object, and not a primitive.

Yet, there is a javascript thing that stores values by reference: the
arguments object.

> function kill(a) { for (var i=0;i<a.length;i++) a[i]=false; }
> function x(a,b,c) { kill(arguments); return[a,b,c] };
> x(true,true,true)
[false, false, false]

I did not assign to a, b or c. Can this be termed "call-with-references"
or something?

Andreas Bergmaier

Scott Sauyet

unread,
Mar 23, 2012, 10:10:13 AM3/23/12
to
Andreas Bergmaier wrote:
> [ ... ]
> Yet, there is a javascript thing that stores values by reference: the
> arguments object.
>
>   > function kill(a) { for (var i=0;i<a.length;i++) a[i]=false; }
>   > function x(a,b,c) { kill(arguments); return[a,b,c] };
>   > x(true,true,true)
>   [false, false, false]
>
> I did not assign to a, b or c. Can this be termed "call-with-references"
> or something?

Sounds like a good name.

Wow. I'd always insisted that JS has no form of call-by-reference.
I'd never noticed that it actually does have this one.

-- Scott

Evertjan.

unread,
Mar 23, 2012, 11:23:57 AM3/23/12
to
Andreas Bergmaier wrote on 23 mrt 2012 in comp.lang.javascript:

> I know, JavaScript does not support call-by-reference. Every function
> invocation does call-by-value, even if that value is a reference value
> to an array-/function-/plain-Object, and not a primitive.

JavaScript DOES support call-by-reference.

All objects are called by reference:

<script type='text/javascript'>

var myObj = {};

myObj.myValue = 7;
alert(myObj.myValue); // 7

function f(a) {
a.myValue = 33;
};

f(myObj);
alert(myObj.myValue); // 33

</script>

> Yet, there is a javascript thing that stores values by reference: the
> arguments object.

This is just a special example of the general fact showen above.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Scott Sauyet

unread,
Mar 23, 2012, 12:28:06 PM3/23/12
to
"Evertjan." wrote:
> Andreas Bergmaier wrote:
>> I know, JavaScript does not support call-by-reference. Every function
>> invocation does call-by-value, even if that value is a reference value
>> to an array-/function-/plain-Object, and not a primitive.
>
> JavaScript DOES support call-by-reference.
>
> All objects are called by reference:

No, references are passed by value. It's perhaps a subtle
distinction, but it's quite important. This means that in Javascript,
unlike in some languages, you cannot do this:

var f = function(out x) { // Error -- no output params
x = "changed";
}

var t = "original";
f(t);
alert(t); // t == "changed";

The value passed as a parameter to the function is a *copy* of the
reference to an object. There's no notion of an output parameter.
Some languages have such facilities. Others do not. Until I saw the
OP, I thought that Javsacript did not. But Andreas has shown that the
`arguments` object provides an exception to this. The exception seems
to be small. It only happens when you pass the `arguments` object to
another function which treats it like an array and reassigns its
elements. We couldn't modify the above code to work in JS without
introducing another function and the only references that could be
changed by another function are the ones used as parameters. But it's
an exception nonetheless:

var f = function(a) {
a[0] = "changed";
}

var g = function(t) {
f(arguments);
alert(t); // t is "changed";
}

g("original");


Very interesting.

-- Scott

Evertjan.

unread,
Mar 23, 2012, 3:41:10 PM3/23/12
to
Scott Sauyet wrote on 23 mrt 2012 in comp.lang.javascript:

> "Evertjan." wrote:
>> Andreas Bergmaier wrote:
>>> I know, JavaScript does not support call-by-reference. Every function
>>> invocation does call-by-value, even if that value is a reference value
>>> to an array-/function-/plain-Object, and not a primitive.
>>
>> JavaScript DOES support call-by-reference.
>>
>> All objects are called by reference:
>
> No, references are passed by value. It's perhaps a subtle
> distinction, but it's quite important. This means that in Javascript,
> unlike in some languages, you cannot do this:

[...]

Reference in my book, in Javascript or any other language,
is transferring the variable-pointer or object-pointer and not the value.

The fact is,
that in Javascript objects are passed by their pointer.

In other words, their pointer IS their value.

So this clearly is passing by reference.

That in othr languages you can choose
does not mean that in Javascript objects are not passed by reference.

BGB

unread,
Mar 23, 2012, 4:03:15 PM3/23/12
to
one option: "call by value" with "reference types".



although not proper JS, my own ES-variant (used mostly for game
scripting) partly adds references as a language extension:
foo(&x, &y);

which may be handled at the target either as:
function foo(rx, ry)
{ *rx=3; *ry=4; }
or, as:
function foo(&x, &y)
{ x=3; y=4; }
which is basically syntax sugar for the above.

functionally "*rx=3;" is more-or-less equivalent to "rx[0]=3;".

note: although vaguely resembling them, these are not to be confused
with C-style pointers (functionally, the reference is "boxed", and
deferred assignment is made into this box).

as-is, the "&x" notation at the call-site is mandatory, given that the
compiler doesn't necessarily know the signature of the call target
(otherwise, things wont work correctly).


or such...

Gene Wirchenko

unread,
Mar 23, 2012, 4:43:27 PM3/23/12
to
On 23 Mar 2012 19:41:10 GMT, "Evertjan."
<exjxw.ha...@interxnl.net> wrote:

>Scott Sauyet wrote on 23 mrt 2012 in comp.lang.javascript:
>
>> "Evertjan." wrote:
>>> Andreas Bergmaier wrote:
>>>> I know, JavaScript does not support call-by-reference. Every function
>>>> invocation does call-by-value, even if that value is a reference value
>>>> to an array-/function-/plain-Object, and not a primitive.
>>>
>>> JavaScript DOES support call-by-reference.
>>>
>>> All objects are called by reference:
>>
>> No, references are passed by value. It's perhaps a subtle
>> distinction, but it's quite important. This means that in Javascript,
>> unlike in some languages, you cannot do this:
>
>[...]
>
>Reference in my book, in Javascript or any other language,
>is transferring the variable-pointer or object-pointer and not the value.

Nope. It is passing in such a way that the actual parameter can
be changed (the one in the call).

>The fact is,
>that in Javascript objects are passed by their pointer.

The question is whether that pointer value can be changed. If it
can, it is call-by-reference. If not, it is call-by-value.

Note that it is irrelevant whether a pointer value can be used to
change another value as in passing an object reference and modifying
one of the object's properties.

>In other words, their pointer IS their value.

>So this clearly is passing by reference.

No. See the test page. If objects were passed by reference in
JavaScript, then Fiddle()'s change of the value of the parameter would
change the actual parameter, too. If you run it, you will see that it
is not changed.

>That in othr languages you can choose
>does not mean that in Javascript objects are not passed by reference.

The two are disconnected.

***** Start of Test Page *****
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>2012-03-23: Object Parameters</title>
</head>

<body>

<script type="text/javascript">

function Fiddle
(
FiddleWithThis
)
{
var StartValue=FiddleWithThis;
if (typeof(FiddleWithThis)=="object")
FiddleWithThis=ThatObject;
else
FiddleWithThis="fiddled";
alert("FiddleWithThis changed: "+(FiddleWithThis!=StartValue));
}

var SomeString="unchanged";
Fiddle(SomeString);
alert("SomeString="+SomeString);

var ThatObject=new Date(2001,1-1,1);
var SomeObject=new Date();
Fiddle(SomeObject);
alert("SomeObject="+SomeObject);

</script>

</body>

</html>
***** End of Test Page *****

Sincerely,

Gene Wirchenko

Evertjan.

unread,
Mar 23, 2012, 5:18:37 PM3/23/12
to
Gene Wirchenko wrote on 23 mrt 2012 in comp.lang.javascript:

>> Reference in my book, in Javascript or any other language,
>> is transferring the variable-pointer or object-pointer
>> and not the value.
>
> Nope.

"Nope"?
Could you speak normal English in this international NG, please.

And why?
Do you know my book?

> It is passing in such a way that the actual parameter can
> be changed (the one in the call).

"actual"? Are there non-actual parameters in javascript?

Please explain what we should call the passing of an object in
javascript.

== Is it by value?

No, because you cannot change the object as such.

== Is it by reference?

Yes, because you can change the object's properties and methods,
which are in fact the "values" of an object.

So I maintain that objects are passed by reference.

<script type='text/javascript'>

var a = {x:9};
var b = {y:19};

function increment(p,z) {
p[z]++;
};

increment(a,'x');

increment(b,'y');

alert(a.x); // 10
alert(b.y); // 20


</script>

Thomas 'PointedEars' Lahn

unread,
Mar 23, 2012, 6:02:14 PM3/23/12
to
Andreas Bergmaier wrote:

> I know, JavaScript does not support call-by-reference. Every function
> invocation does call-by-value, even if that value is a reference value
> to an array-/function-/plain-Object, and not a primitive.

Correct.

> Yet, there is a javascript thing

There is no "javascript".

> that stores values by reference: the arguments object.

No. According to ECMAScript Edition 5(.1) [ES5], section 10.6, the
Arguments object has special internal [[Get]] and [[Set]] methods to allow
the observed behavior.

> > function kill(a) { for (var i=0;i<a.length;i++) a[i]=false; }
> > function x(a,b,c) { kill(arguments); return[a,b,c] };
> > x(true,true,true)
> [false, false, false]
>
> I did not assign to a, b or c. Can this be termed "call-with-references"
> or something?

Yes (it can be termed something).

The behavior you observed has been removed for strict code in [ES5].


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

BGB

unread,
Mar 23, 2012, 6:23:50 PM3/23/12
to
On 3/23/2012 2:18 PM, Evertjan. wrote:
> Gene Wirchenko wrote on 23 mrt 2012 in comp.lang.javascript:
>
>>> Reference in my book, in Javascript or any other language,
>>> is transferring the variable-pointer or object-pointer
>>> and not the value.
>>
>> Nope.
>
> "Nope"?
> Could you speak normal English in this international NG, please.
>
> And why?
> Do you know my book?
>
>> It is passing in such a way that the actual parameter can
>> be changed (the one in the call).
>
> "actual"? Are there non-actual parameters in javascript?
>
> Please explain what we should call the passing of an object in
> javascript.
>
> == Is it by value?
>
> No, because you cannot change the object as such.
>

if we define an object as a "reference type", then the "object
reference" is being passed by-value.


> == Is it by reference?
>
> Yes, because you can change the object's properties and methods,
> which are in fact the "values" of an object.
>

this only goes so far as to say that one has a reference to the object's
data (IOW, it is not being "physically" passed in the same manner as,
say, a C struct).


> So I maintain that objects are passed by reference.
>

"passing by reference" generally refers to the idea that it is the
variable itself which is being passed by reference.

when passing an object, one is passing a reference to the object, and
not to the variable holding the object.

these sorts of distinctions are important.


> <script type='text/javascript'>
>
> var a = {x:9};
> var b = {y:19};
>
> function increment(p,z) {
> p[z]++;
> };
>
> increment(a,'x');
>
> increment(b,'y');
>
> alert(a.x); // 10
> alert(b.y); // 20
>
>
> </script>
>

this example does not show "pass by reference", it shows that one has "a
reference to the object" (which is itself passed "by value").


what *would* show "pass by reference", would be if this were to work:
function increment(x)
{ x++; }
var x=3;
increment(x);
alert(x); // 4

given it does not (one will still see 3 here), one can conclude that it
is not using "pass by reference".

this is in-fact the default behavior in some languages (such as VB and
Perl), but is relatively uncommon (most languages use "pass by value"
instead, despite objects generally being "references").


http://en.wikipedia.org/wiki/Pass_by_reference#Call_by_reference


note that many languages that do support pass-by-reference, do so via
explicit syntax, for example:
foo(&x);
foo(ref x);
foo(out x);
...

Gene Wirchenko

unread,
Mar 23, 2012, 6:27:43 PM3/23/12
to
On 23 Mar 2012 21:18:37 GMT, "Evertjan."
<exjxw.ha...@interxnl.net> wrote:

>Gene Wirchenko wrote on 23 mrt 2012 in comp.lang.javascript:
>
>>> Reference in my book, in Javascript or any other language,
>>> is transferring the variable-pointer or object-pointer
>>> and not the value.
>>
>> Nope.
>
>"Nope"?
>Could you speak normal English in this international NG, please.

No, I actually can not *speak* English on USENET as it is a
written medium.

(Your language snarking is not very nice.)

>And why?
>Do you know my book?

No.

>> It is passing in such a way that the actual parameter can
>> be changed (the one in the call).
>
>"actual"? Are there non-actual parameters in javascript?

No.

Actual parameters are the parameters in a call. The parameters
as declared in the function are called formal parameters.

>Please explain what we should call the passing of an object in
>javascript.
>
>== Is it by value?
>
>No, because you cannot change the object as such.

Yes, because you can not change the formal parameter value and
have it reflect on the actual parameter.

>== Is it by reference?
>
>Yes, because you can change the object's properties and methods,
>which are in fact the "values" of an object.

No, because <same as above>. That that value is a pointer is
irrelevant.

>So I maintain that objects are passed by reference.

Sorry, but you have it reversed.

><script type='text/javascript'>
>
>var a = {x:9};
>var b = {y:19};
>
>function increment(p,z) {
> p[z]++;
>};
>
>increment(a,'x');
>
>increment(b,'y');
>
>alert(a.x); // 10
>alert(b.y); // 20
>
>
></script>

The code does not change the value of a or b. That it changes
the value of something that they point to is irrelevant.

This might make my point better. Write a function that swaps two
pointer values. Here is the driver code:

var Obj1=new Date(2001,1-1,1);
Var Obj2=new Date();
var Obj1Save=Obj1;
var Obj2Save=Obj2;

Swap(Obj1,Obj2);

alert((Obj1==Obj2Save) && (Obj2==Obj1Save));

If you do it right, the alert should display true.

Sincerely,

Gene Wirchenko

Evertjan.

unread,
Mar 23, 2012, 8:19:26 PM3/23/12
to
Gene Wirchenko wrote on 23 mrt 2012 in comp.lang.javascript:

> (Your language snarking is not very nice.)

Being very nice is not the topic of this NG.

Please explain "snarking", is it part of ECMA?

>>>> Nope

Please explain "nope"

> Sorry, but you have it reversed.

Is that mainstream English?

Why are you sorry?

> Sincerely,

Quite.

John G Harris

unread,
Mar 24, 2012, 7:34:22 AM3/24/12
to
On Fri, 23 Mar 2012 at 15:27:43, in comp.lang.javascript, Gene Wirchenko
wrote:

<snip>
> Actual parameters are the parameters in a call. The parameters
>as declared in the function are called formal parameters.
<snip>

In a maths book 'parameter' is what you see in the function definition
and 'argument' is what you supply when you call the function.

Computer science sometimes uses this terminology and sometimes uses
formal/actual :-(

John
--
John Harris

John G Harris

unread,
Mar 24, 2012, 7:40:03 AM3/24/12
to
On Fri, 23 Mar 2012 at 23:02:14, in comp.lang.javascript, Thomas
'PointedEars' Lahn wrote:

<snip>
>There is no "javascript".
<snip>

There is more than one "Thomas Lahn", yet people shouldn't be criticised
for using the symbol.

John
--
John Harris

Scott Sauyet

unread,
Mar 24, 2012, 9:13:04 PM3/24/12
to
Evertjan wrote:
> Gene Wirchenko wrote:
>
>>> Reference in my book, in Javascript or any other language,
>>> is transferring the variable-pointer or object-pointer
>>> and not the value.
>
>> Nope.
>
> "Nope"?
> Could you speak normal English in this international NG, please.

Did you really not understand this? This is the first time I've seen
someone here whose understanding of idiomatic English seems fairly
firm but who wouldn't recognize "nope" as an informal, but very common
English synonym for "no". The word carries overtones slightly
different from plain "no", especially when used as a single-word
response to a declaration; whereas "no" might have other implications,
"nope" almost always implies, "you're wrong about that." So did you
really not understand it? Or are you simply being snarky? [1]


> And why?
> Do you know my book?

I think the implication is that your book is wrong. But when you use
"in my book", you appear to be someone who has a clear understanding
of idiomatic English. Again, did you really not recognize "nope"?


-- Scott

[1] https://www.google.com/search?q=snarky

Evertjan.

unread,
Mar 25, 2012, 4:12:36 AM3/25/12
to
Scott Sauyet wrote on 25 mrt 2012 in comp.lang.javascript:

> Did you really not understand this? This is the first time I've seen
> someone here whose understanding of idiomatic English seems fairly
> firm but who wouldn't recognize "nope" as an informal, but very common
> English synonym for "no". The word carries overtones slightly
> different from plain "no", especially when used as a single-word
> response to a declaration; whereas "no" might have other implications,
> "nope" almost always implies, "you're wrong about that." So did you
> really not understand it? Or are you simply being snarky? [1]

I don't think I want to follow your link about "snarky". It is just like
"nope", see below, a word not to be used here because of local idiomatic
implications.

>> And why?
>> Do you know my book?
>
> I think the implication is that your book is wrong.

In sensu strictior the "nope" just says that it is not in my book, quod
non.

> But when you use
> "in my book", you appear to be someone who has a clear understanding
> of idiomatic English. Again, did you really not recognize "nope"?

Scot, this is not email but usenet. So responses should not go specificly
and do not go uniquely to the poster responded upon.
[The "Scot" just means that I respond to the above text written by Scot,
not that I specifically address him/you, because then I should have used
email]

What I personally understand or can easily guess about English idiom is
not that important as keeping the conversation understandable for the
total NG-audience. Even so as a polyglottic English and so British
native, I cannot and dion't want to claim to understand the idiomatic
differences felt in other parts of the world where English lately became
the first language, like India, the States, etc.

In an international NG, that uses English as a lingua franca,
English monoglots should be aware not to use this as an easy advantage by
using local idioms.

So claiming it is alright to use some idiom, just because the claiming
monoglot claims he is an English native, is Netiquettically wrong.
[Unless a NG has English idiom as a topic, ofcourse]

"nope" is a clear example of a word to be avoided, because when it is no
different from "no", why use it, but for adding some extra perhaps
condescending, innuendo, that could mean "we the English natives know
better".

That's why a question of "what do you mean by that word" is not out of
place in this NG.

Scott Sauyet

unread,
Mar 25, 2012, 10:00:19 AM3/25/12
to
Evertjan wrote:
> Scott Sauyet wrote:
>
>> Did you really not understand this?  This is the first time I've seen
>> someone here whose understanding of idiomatic English seems fairly
>> firm but who wouldn't recognize "nope" as an informal, but very common
>> English synonym for "no".  [ ... ]  So did you
>> really not understand it?  Or are you simply being snarky?  [1]
>
> I don't think I want to follow your link about "snarky". It is just like
> "nope", see below, a word not to be used here because of local idiomatic
> implications.

Well, it is not, as far as I know, an Americanism. In fact, the only
usages I've seen of "snarky" are on internet discussions, USENET or
otherwise.

But if you didn't notice, I was disagreeing with your contention that
"nope" shouldn't be used here. If you had asked what was meant by
"nope", someone would almost certainly have explained. But it's
simply not obscure enough to avoid. If someone uses "truck" instead
of "lorry" in this forum, certainly she is helping pinpoint where she
learned English, but she is not likely confusing anyone. (Now if
someone uses a generic version of "forum" -- which certainly
encompasses USENET news groups -- to describe comp.lang.javascript, he
might well be told that this is not a forum, but a newsgroup. It's a
risk I'm prepared to accept.)

>>> And why?
>>> Do you know my book?
>
>> I think the implication is that your book is wrong.
>
> In sensu strictior the "nope" just says that it is not in my book, quod
> non.

And being just as strict, Gene should perhaps have asked precisely
which book you meant. But he understood that phrase, and still
responded to the underlying misconception and not to your phrasing it
as merely your opinion.


>> But when you use
>> "in my book", you appear to be someone who has a clear understanding
>> of idiomatic English.  Again, did you really not recognize "nope"?
>
> Scot, this is not email but usenet. So responses should not go specificly
> and do not go uniquely to the poster responded upon.

Nonetheless, dialogues occur frequently, and as long as the points
made are applicable to a general audience, there is no harm in
responding in such a fashion. Are you not the one who said, "And
why? Do you know my book?" which is a clear-cut conversational
style.


> [The "Scot" just means that I respond to the above text written by Scot,
> not that I specifically address him/you, because then I should have used
> email]

"him/you"??? I think you're undermining your own point here. :-)


> [ ... ]
> In an international NG, that uses English as a lingua franca,
> English monoglots should be aware not to use this as an easy advantage by
> using local idioms.

And should people refrain from an occasional Latin phrase too, as a
much larger portion of the readers are likely not to recognize that?
I think not. Those who don't understand can look up, say, "sensu
strictior" or ask for clarification.


> So claiming it is alright to use some idiom, just because the claiming
> monoglot claims he is an English native, is Netiquettically wrong.

Nope.

:-)


> "nope" is a clear example of a word to be avoided, because when it is no
> different from "no", why use it, but for adding some extra perhaps
> condescending, innuendo, that could mean "we the English natives know
> better".

Is "nope" actually an Americanism? I think not. Although it might
not be the Queen's English, it's widely understood. And I've never
heard any particular condescending innuendo attached to it either,
just the sense of informality that would allow it to stand in for a
plain "no", but not for the "no" in "no, thank you".


> That's why a question of "what do you mean by that word" is not out of
> place in this NG.

It's hard to imagine appeals for clarification to ever be out of
bounds.

Okay, this is far off-topic. Feel free to respond, but I think I've
said far more than I ever needed to on this.

-- Scott

Scott Sauyet

unread,
Mar 25, 2012, 10:34:35 AM3/25/12
to
Evertjan wrote:
> Scott Sauyet wrote:
>> "Evertjan." wrote:
>>> Andreas Bergmaier wrote:
>>>> I know, JavaScript does not support call-by-reference. Every function
>>>> invocation does call-by-value, even if that value is a reference value
>>>> to an array-/function-/plain-Object, and not a primitive.
>
>>> JavaScript DOES support call-by-reference.
>
>>> All objects are called by reference:
>
>> No, references are passed by value.  It's perhaps a subtle
>> distinction, but it's quite important.  [ ... ]
>
> Reference in my book, in Javascript or any other language,
> is transferring the variable-pointer or object-pointer and not the value.

It's not clear to me if you've understood the distinction being made
here. The usual definition of "pass by reference" would yield the
behavior described by BGB:

function increment(x) {x++;}
var x=3;
increment(x);
alert(x); // 4 if x was passed by reference, 3 if by value

Yes, when we pass objects to functions, we pass something like
pointers to these objects, but the pointers inside the function are
*copies* of the pointers supplied when calling the function, not the
original pointers. This is easy to see by reassigning the parameters
inside the function to new objects and noting that the pointers of the
original caller are not changed.

A pretty good description of the difference is a C# article by John
Skeet [1] Even if you don't know the language syntax, I think it's
reasonably easy to understand.

-- Scott

[1] http://www.yoda.arachsys.com/csharp/parameters.html

Evertjan.

unread,
Mar 25, 2012, 11:53:28 AM3/25/12
to
Scott Sauyet wrote on 25 mrt 2012 in comp.lang.javascript:

> Yes, when we pass objects to functions, we pass something like
> pointers to these objects, but the pointers inside the function are
> *copies* of the pointers supplied when calling the function, not the
> original pointers. This is easy to see by reassigning the parameters
> inside the function to new objects and noting that the pointers of the
> original caller are not changed.

Good point.

Logical reasoning can easily change my 'book',
where "widely understood in other programming languages" does not.

It boils down to what you mean by "reference",
a pointer being a "reference" in optima forma.

However I can live with your reasoning.

John G Harris

unread,
Mar 26, 2012, 5:56:33 AM3/26/12
to
On Sun, 25 Mar 2012 at 07:00:19, in comp.lang.javascript, Scott Sauyet
wrote:

<snip>
>Is "nope" actually an Americanism? I think not.

My feeling is that "nope" is a Hollywood idea of the Cowboy dialect.
Think John Wayne. I certainly don't remember anyone here in England
using it in ordinary conversation.


> Although it might
>not be the Queen's English, it's widely understood. And I've never
>heard any particular condescending innuendo attached to it either,
>just the sense of informality that would allow it to stand in for a
>plain "no", but not for the "no" in "no, thank you".
<snip>

When John Wayne uses it it has a different emphasis to a plain "no".
It's more abrupt and final.


FWIW

John
--
John Harris

Aatu Koskensilta

unread,
Mar 26, 2012, 3:46:01 PM3/26/12
to
"Evertjan." <exjxw.ha...@interxnl.net> writes:

> Gene Wirchenko wrote on 23 mrt 2012 in comp.lang.javascript:
>
>> Nope.
>
> "Nope"?
> Could you speak normal English in this international NG, please.

"Nope" is perfectly normal English.

> Please explain what we should call the passing of an object in
> javascript.

In general it's not possible to pass an object as an argument for a
function in Javascript, by reference or otherwise. What is possible is
to pass by value a reference to an object.

--
Aatu Koskensilta (aatu.kos...@uta.fi)

"Wovon man nicht sprechen kann, darüber muss man schweigen."
- Ludwig Wittgenstein, Tractatus Logico-Philosophicus

Aatu Koskensilta

unread,
Mar 26, 2012, 4:04:59 PM3/26/12
to
"Evertjan." <exjxw.ha...@interxnl.net> writes:

> I don't think I want to follow your link about "snarky". It is just
> like "nope", see below, a word not to be used here because of local
> idiomatic implications.

Come now, "snarky" is perfectly normal English and readily
understandable to a competent non-native speaker.

> "nope" is a clear example of a word to be avoided, because when it is no
> different from "no", why use it, but for adding some extra perhaps
> condescending, innuendo, that could mean "we the English natives know
> better".

You're imagining things. It's of course a good idea to avoid obscure
local idioms, but "nope" is not in the least problematic in this
respect, and certainly does not imply any native speaker superiority in
ordinary usage. Your harping on this issue is merely bizarre, and if
you're genuinly worried about poor hapless non-natives with their
tenuous grasp on the intricacies of English, I suggest instead of these
peculiar tirades you work on your sentence construction.

Gene Wirchenko

unread,
Mar 26, 2012, 9:38:06 PM3/26/12
to
On Mon, 26 Mar 2012 22:46:01 +0300, Aatu Koskensilta
<aatu.kos...@uta.fi> wrote:

>"Evertjan." <exjxw.ha...@interxnl.net> writes:
>
>> Gene Wirchenko wrote on 23 mrt 2012 in comp.lang.javascript:
>>
>>> Nope.
>>
>> "Nope"?
>> Could you speak normal English in this international NG, please.
>
> "Nope" is perfectly normal English.
>
>> Please explain what we should call the passing of an object in
>> javascript.
>
> In general it's not possible to pass an object as an argument for a
>function in Javascript, by reference or otherwise. What is possible is
>to pass by value a reference to an object.

"In general"? How is it *ever* possible to pass an object by
reference? I can not think of a way. If there is one, I would really
like to know.

The only way that I can think of that would come close would be
embedding the object references as an object properties. Something
like:

Obj1={Word1: "Hello", Word2: "World"};
Obj2={Word1: "Good", Word2: "night"};

Obj3={Ref1: Obj1, Ref2: Obj2};

function Swap(theObject)
{
var ObjTemp=theObject.Ref1;
theObject.Ref1=theObject.Ref2;
theObject.Ref2=ObjTemp;
}

Swap(Obj3);

which -- if I have not goofed somewhere -- should swap the values of
the Obj1 and Obj2 properties.

Sincerely,

Gene Wirchenko

Aatu Koskensilta

unread,
Mar 26, 2012, 10:13:54 PM3/26/12
to
Gene Wirchenko <ge...@ocis.net> writes:

> On Mon, 26 Mar 2012 22:46:01 +0300, Aatu Koskensilta
> <aatu.kos...@uta.fi> wrote:
>
>> In general it's not possible to pass an object as an argument for a
>>function in Javascript, by reference or otherwise. What is possible is
>>to pass by value a reference to an object.
>
> "In general"? How is it *ever* possible to pass an object by
> reference? I can not think of a way. If there is one, I would really
> like to know.

As mentionted in this thread, apparently the arguments object is
passed by reference.

Robert Baer

unread,
Mar 27, 2012, 1:31:20 AM3/27/12
to
* being picky.."lingua franca" as in "language (of) France" or as in
"common language consisting of Italian mixed with French, Spanish,
Greek, and Arabic" or "language of/for confirmation"?

Evertjan.

unread,
Mar 27, 2012, 3:25:15 AM3/27/12
to
Robert Baer wrote on 27 mrt 2012 in comp.lang.javascript:

> * being picky.."lingua franca" as in "language (of) France" or as in
> "common language consisting of Italian mixed with French, Spanish,
> Greek, and Arabic" or "language of/for confirmation"?

Your being picky [why?] leads you astray.

"Franca" here does not mean "of France" but means "free".
[France being called after the free germanic tribegroup the Franks]

Examples of linguae francae are: Koine Greek, Malay, Latin, Swahili, etc

<http://en.wikipedia.org/wiki/Lingua_franca>
<http://en.wikipedia.org/wiki/Franks>

Asen Bozhilov

unread,
Mar 27, 2012, 8:15:35 AM3/27/12
to
Evertjan:

> JavaScript DOES support call-by-reference.
>
> All objects are called by reference:

This is long discussed topic. Your terminology even and it is not correct seems more closer to the point. JavaScript uses the evaluation strategy called "Call by sharing".
<URL: http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing>

It is often mistaken with "Call by reference", but it slightly differ:

"The semantics of call-by-sharing differ from call-by-reference in that assignments to function arguments within the function aren't visible to the caller (unlike by-reference semantics)[citation needed], so e.g. if a variable was passed, it is not possible to simulate an assignment on that variable in the caller's scope. However since the function has access to the same object as the caller (no copy is made), mutations to those objects, if the objects are mutable, within the function are visible to the caller, which may appear to differ from call-by-value semantics."


> <script type='text/javascript'>
>
> var myObj = {};
>
> myObj.myValue = 7;
> alert(myObj.myValue); // 7
>
> function f(a) {
> a.myValue = 33;
> };
>
> f(myObj);
> alert(myObj.myValue); // 33
>
> </script>

It does not prove your point.

function f(o) {
o.foo = 10;
o = {foo : 0};
}

var obj = {foo : 5};
f(obj);

print(obj.foo); //10

This example shows that JavaScript does not use "Call by reference" if it used the value of `foo` would be 0 instead. The example shows "Call by sharing" strategy.

Thomas 'PointedEars' Lahn

unread,
Mar 27, 2012, 12:31:59 PM3/27/12
to
Aatu Koskensilta wrote:

> Gene Wirchenko <ge...@ocis.net> writes:
>> Aatu Koskensilta wrote:
>>> In general it's not possible to pass an object as an argument for a
>>> function in Javascript, by reference or otherwise. What is possible is
>>> to pass by value a reference to an object.
>>
>> "In general"? How is it *ever* possible to pass an object by
>> reference? I can not think of a way. If there is one, I would really
>> like to know.
>
> As mentionted in this thread, apparently the arguments object is
> passed by reference.

As explained in this thread, it is not.

Aatu Koskensilta

unread,
Mar 27, 2012, 2:31:40 PM3/27/12
to
Thomas 'PointedEars' Lahn <Point...@web.de> writes:

> Aatu Koskensilta wrote:
>
>> As mentionted in this thread, apparently the arguments object is
>> passed by reference.
>
> As explained in this thread, it is not.

Right. We could say the arguments object allows one to simulate pass
by reference for certain variables in certain special situations, but
this is pedantry more tedious than even I have much inclination for.

Thomas 'PointedEars' Lahn

unread,
Mar 27, 2012, 3:03:36 PM3/27/12
to
Aatu Koskensilta wrote:

> Thomas 'PointedEars' Lahn <Point...@web.de> writes:
>> Aatu Koskensilta wrote:
>>> As mentionted in this thread, apparently the arguments object is
>>> passed by reference.
>>
>> As explained in this thread, it is not.
>
> Right. We could say the arguments object allows one to simulate pass
> by reference for certain variables in certain special situations, but
> this is pedantry more tedious than even I have much inclination for.

You are missing the point.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann

Dr J R Stockton

unread,
Mar 27, 2012, 1:20:14 PM3/27/12
to
In comp.lang.javascript message <87aa33c...@uta.fi>, Mon, 26 Mar
2012 23:04:59, Aatu Koskensilta <aatu.kos...@uta.fi> posted:

> You're imagining things. It's of course a good idea to avoid obscure
>local idioms, but "nope" is not in the least problematic in this
>respect, and certainly does not imply any native speaker superiority in
>ordinary usage. Your harping on this issue is merely bizarre, and if
>you're genuinly worried about poor hapless non-natives with their
>tenuous grasp on the intricacies of English, I suggest instead of these
>peculiar tirades you work on your sentence construction.

You need to believe that Evertjan has learned, rather well, proper
English; on the other hand, less experienced programmers are likely to
have acquired what the Americans think of as English. "Nope" might be
spoken, but is not commonly written, by grown-up Britons (and Dutch?)

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike 6.05 WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links.
Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
DOS/Win/UNIX now 2.0.6; see <URL:http://www.merlyn.demon.co.uk/pc-links.htm>.

Gene Wirchenko

unread,
Mar 27, 2012, 7:28:37 PM3/27/12
to
On Tue, 27 Mar 2012 18:20:14 +0100, Dr J R Stockton
<repl...@merlyn.demon.co.uk.not.invalid> wrote:

>In comp.lang.javascript message <87aa33c...@uta.fi>, Mon, 26 Mar
>2012 23:04:59, Aatu Koskensilta <aatu.kos...@uta.fi> posted:
>
>> You're imagining things. It's of course a good idea to avoid obscure
>>local idioms, but "nope" is not in the least problematic in this
>>respect, and certainly does not imply any native speaker superiority in
>>ordinary usage. Your harping on this issue is merely bizarre, and if
>>you're genuinly worried about poor hapless non-natives with their
>>tenuous grasp on the intricacies of English, I suggest instead of these
>>peculiar tirades you work on your sentence construction.
>
>You need to believe that Evertjan has learned, rather well, proper
>English; on the other hand, less experienced programmers are likely to
>have acquired what the Americans think of as English. "Nope" might be

Well, I have been programming since I was 14 and am now 51 so I
do not thing that I fit the less-experienced category. I have seen
"nope" written before, and I do not recall it ever having caused
confusion. If you and Evertjan need some English tutoring, I am sure
that we could oblige.

Evertjan was simply looking for things to complain about...

>spoken, but is not commonly written, by grown-up Britons (and Dutch?)

...and is not doing so well on the grown-up category.

Think of it as me helping expand your knowledge of the world by
just that little, extra bit.

Sincerely,

Gene Wirchenko

Evertjan.

unread,
Mar 28, 2012, 4:20:45 AM3/28/12
to
Gene Wirchenko wrote on 28 mrt 2012 in comp.lang.javascript:

>>You need to believe that Evertjan has learned, rather well, proper
>>English; on the other hand, less experienced programmers are likely to
>>have acquired what the Americans think of as English. "Nope" might be
>
> Well, I have been programming since I was 14 and am now 51 so I
> do not thing that I fit the less-experienced category.

John and I, we are much older and are much longer into programming.

So if programming experience is measured in time, what you imply here, then
yes, you perfectly fit this less-experienced category.

> I have seen "nope" written before, and I do not recall it ever having
> caused confusion.

That does not mean a thing.

This confusion might not have been divulged, some people do not like to be
shown inexperienced, even in some distant local slang, which they
mistakenly could have thought to be mainstream English.

This latest category even fits you, and you being a selfprofessed native.

Or you might not have noticed, since you appear not to care very much for
writing mainstream understandable English in an international NG,
saying that anything is correct as long as you do not notice confusion,
and even pride yourself for widening the knowledge.

And probably you are a newbee in this NG.

> If you and Evertjan need some English tutoring, I am sure
> that we could oblige.

"we", that is a nice pluralis majestatis, or are you implying the NG by
using "we" to set some, in this case far more experienced NG'ers apart.

What year, btw, dit you start using javascript and when did you first post
in this NG, Gene?

In my view, good reasoning is far more important than staving your points
with how long one is programming or how young one is.


> Evertjan was simply looking for things to complain about...
>
>> spoken, but is not commonly written, by grown-up Britons (and Dutch?)
>
> ...and is not doing so well on the grown-up category.

Typical of the young, that boast to have been programming at the age of 14.


> Think of it as me helping expand your knowledge of the world by
> just that little, extra bit.

"It"? Think of what?

You adding to the difficulty of the ones not fluent in English using local
slang in an international NG?

This NG's topic is Javascript, so only javascript and by Netiquette, the
functioning of this NG, is on topic.

Expanding someone's knowledge of the world by teaching distant local slang
definitely is off topic. Search for a NG about local English slang if the
urge is so compelling.

"knowledge of the world"?

English is not that important to the wold that you should teach it's local
slang in a javascript NG.

Norman Peelman

unread,
Mar 28, 2012, 6:43:36 AM3/28/12
to
On 03/23/2012 08:19 PM, Evertjan. wrote:
> Gene Wirchenko wrote on 23 mrt 2012 in comp.lang.javascript:
>
>> (Your language snarking is not very nice.)
>
> Being very nice is not the topic of this NG.
>
> Please explain "snarking", is it part of ECMA?
>
>>>>> Nope
>
> Please explain "nope"
>
>> Sorry, but you have it reversed.
>
> Is that mainstream English?
>

It is mainstream slang for 'no' or 'no it is not', 'no I do not want
to', 'no, I can not', or what ever you want to tack on. It is used here
in the US as part of routine conversation, specially when being
difficult (in order to have a little fun at someones expense) with your
answers. Or even when you are being seriously short with your answers,
in order to say 'no' ('no, not interested') without coming across too stern.

> Why are you sorry?
>
>> Sincerely,
>
> Quite.
>

--
Norman
Registered Linux user #461062
AMD64X2 6400+ Ubuntu 10.04 64bit

Evertjan.

unread,
Mar 28, 2012, 10:50:18 AM3/28/12
to
Norman Peelman wrote on 28 mrt 2012 in comp.lang.javascript:

> It is mainstream slang for 'no' or 'no it is not', 'no I do not want
> to', 'no, I can not', or what ever you want to tack on. It is used
> here in the US as part of routine conversation,

So it is not quite mainstream,
it is US local slang, an Americanism perhaps.

Local "routine converstation" does not rule out the use of slang,
as seen from a linguistical distance.

> specially when being
> difficult (in order to have a little fun at someones expense) with
> your answers. Or even when you are being seriously short with your
> answers, in order to say 'no' ('no, not interested') without coming
> across too stern.

Typically this is local interpretation.

Earlier in this thread I was assured that it just ment "no",
without any additional innuendo. So you contradict that assurance?

Anyhow, for my part this is not specifically about "nope" or "snarking" but
about using local slang that might be unnecessarily difficult to interprete
by those NG-users who are less fluent in English.

It is also about discussion by reasoning instead of by claiming more
experience, or better status.

Aatu Koskensilta

unread,
Mar 28, 2012, 11:06:45 AM3/28/12
to
"Evertjan." <exjxw.ha...@interxnl.net> writes:

> it is US local slang, an Americanism perhaps.

"Nope" is hardly slang. It's just informal.

> Earlier in this thread I was assured that it just ment "no", without
> any additional innuendo. So you contradict that assurance?

There is no innuendo. Nope means no, but is used only in certain
conversational contexs, where it has the meaning "no, in fact that's not
true", "no, in actual fact that's not how it's done", "no, I don't
agree", and so on. That is, nope means just no, but can be used in this
wholly transparent meaning only in certain circumstances, where it
serves a useful conversational function. There's nothing particularly
noteworthy about this -- it's merely an example of a familiar and common
phenomenon in language.

> Anyhow, for my part this is not specifically about "nope" or
> "snarking" but about using local slang that might be unnecessarily
> difficult to interprete by those NG-users who are less fluent in
> English.

Sure, as I already said, it's best to avoid obscure local idioms,
slang and other turns of phrase that might cause confusion. But "nope"
is not "local slang" (and neither is "snarking" for that matter). "Nope"
is informal American English, readily understandable to pretty much
anyone.

Evertjan.

unread,
Mar 28, 2012, 11:57:28 AM3/28/12
to
Aatu Koskensilta wrote on 28 mrt 2012 in comp.lang.javascript:

> "Evertjan." <exjxw.ha...@interxnl.net> writes:
>
>> it is US local slang, an Americanism perhaps.
>
> "Nope" is hardly slang. It's just informal.

Aatu, so it is slang, but hardly so?

And what do you mean by "just" here?
Is it only informal and nothing else,
or is it marginally informal?

btw, where do you get this information?

Slang can mean a lot,
we could discuss that,
but there is no "formal slang",
so all slang is informal.

The point is it is local slang, with the stress on local,
so one should not use such words in this NG,
it is slang nevertheless.

Scott Sauyet

unread,
Mar 28, 2012, 4:33:11 PM3/28/12
to
Evertjan wrote:
> The point is it is local slang, with the stress on local,
> so one should not use such words in this NG,
> it is slang nevertheless.

Nope.

Eric Bednarz

unread,
Mar 28, 2012, 5:22:31 PM3/28/12
to
"Evertjan." <exjxw.ha...@interxnl.net> writes:

[...]

> so one should not use such words in this NG,

Yep.

Evertjan.

unread,
Mar 29, 2012, 3:18:16 AM3/29/12
to
Quite.

What about "Yep", Eric?

Eric Bednarz

unread,
Mar 29, 2012, 7:34:58 AM3/29/12
to
"Evertjan." <exjxw.ha...@interxnl.net> writes:

> Eric Bednarz wrote on 28 mrt 2012 in comp.lang.javascript:
^^^
Please don't use local abbreviations in international news groups.

For your pleasure:
http://yepnopejs.com/

--
λ

David Mark

unread,
Mar 29, 2012, 9:30:46 PM3/29/12
to
On Mar 29, 7:34 am, Eric Bednarz <bedn...@fahr-zur-hoelle.org> wrote:
> "Evertjan." <exjxw.hannivo...@interxnl.net> writes:
> > Eric Bednarz wrote on 28 mrt 2012 in comp.lang.javascript:
>
>                            ^^^
> Please don't use local abbreviations in international news groups.
>
> For your pleasure:http://yepnopejs.com/
>

Ugh, I suspect you are making a joke, but have to mention that
"polyfills" are ill-advised and backward. Shouldn't augment host
objects and the pattern requires reproducing the missing feature(s) in
their entirety (which is the last thing most projects need). It's just
another bad idea that has gained "traction" among developers who don't
understand browser scripting (the majority of course).

Robert Baer

unread,
Mar 30, 2012, 4:49:41 AM3/30/12
to
Evertjan. wrote:
> Eric Bednarz wrote on 28 mrt 2012 in comp.lang.javascript:
>
>> "Evertjan."<exjxw.ha...@interxnl.net> writes:
>>
>> [...]
>>
>>> so one should not use such words in this NG,
>>
>> Yep.
>
> Quite.
>
> What about "Yep", Eric?
>
>
Well, for one, use of "yep" too many times would make you a "yeppie"
which should not be confused with a "yuppie" because of the different
vowel..

Eric Bednarz

unread,
Apr 2, 2012, 6:09:33 PM4/2/12
to
David Mark <dmark....@gmail.com> writes:

> On Mar 29, 7:34 am, Eric Bednarz <bedn...@fahr-zur-hoelle.org> wrote:
>> "Evertjan." <exjxw.hannivo...@interxnl.net> writes:
>> > Eric Bednarz wrote on 28 mrt 2012 in comp.lang.javascript:
>>
>>                            ^^^
>> Please don't use local abbreviations in international news groups.
>>
>> For your pleasure:http://yepnopejs.com/
>
> Ugh,

That might not be proper Breton-ish English. In case my head explodes,
contact Stockton asap for further instructions.

> I suspect you are making a joke,

Yup (have you read this thread?).

David Mark

unread,
Apr 2, 2012, 8:43:01 PM4/2/12
to
On Apr 2, 6:09 pm, Eric Bednarz <bedn...@fahr-zur-hoelle.org> wrote:
Nope. Well, not nearly all of it; but I saw where it went off track. :
(

Ross A. Finlayson

unread,
Apr 11, 2012, 1:03:35 AM4/11/12
to
On Mar 27, 11:31 am, Aatu Koskensilta <aatu.koskensi...@uta.fi> wrote:
> Thomas 'PointedEars' Lahn <PointedE...@web.de> writes:
>
> > Aatu Koskensilta wrote:
>
> >>   As mentionted in this thread, apparently the arguments object is
> >> passed by reference.
>
> > As explained in this thread, it is not.
>
>   Right. We could say the arguments object allows one to simulate pass
> by reference for certain variables in certain special situations, but
> this is pedantry more tedious than even I have much inclination for.
>
> --
> Aatu Koskensilta (aatu.koskensi...@uta.fi)
>
> "Wovon man nicht sprechen kann, darüber muss man schweigen."
>   - Ludwig Wittgenstein, Tractatus Logico-Philosophicus
>
>

"Coding"
0 new messages