Questions tagged [call-by-value]

Evaluation that bounds the resulting value to the corresponding variable in the function (frequently copying the value into a new memory region).

95 questions
0
votes
2 answers

Is this call-by-reference?

I have an ArrayList: ArrayList ReceivedPackets = new ArrayList(); And I have another ArrayList: ArrayList returnList = ReceivedPackets; Why does returnList loose it's value when I run this code? ArrayList ReceivedPackets = new ArrayList(); //…
Christoph
  • 542
  • 4
  • 24
0
votes
1 answer

XML function by value issue?

I have a function that returns a hash table with a variety of keys, one of which is XML. I also have some code that is intended to revise this XML before returning it. However, I am having what at first appeared to be pipeline pollution issues, but…
Gordon
  • 6,257
  • 6
  • 36
  • 89
0
votes
2 answers

Pass by value - List name

Can someone tell me what I am doing wrong here? I trying to pass the list name to a method that would delete all the rows in the list: public static void DeleteLastUpdate(Microsoft.SharePoint.Client.List oList) { using (var context =…
SharePointDummy
  • 347
  • 1
  • 6
  • 22
0
votes
1 answer

Does Church-Rosser theorem apply to call-by-value reduction?

I've been studying the lambda calculus and recently saw the Church-Rosser theorem. The theorem states that when applying reduction rules to terms in the lambda calculus, the ordering in which the reductions are chosen does not make a difference to…
Roger Fu
  • 1
  • 2
0
votes
2 answers

References of objects in Java EE. Difference for remote and local interfaces?

As far as I know, Java is only call-by-reference. If an entity has to go through a remote interface, can it still have a reference? Now the entity is basically in another container, how can it still have the reference of the object? In other words:…
yemerra
  • 1,352
  • 4
  • 19
  • 44
0
votes
0 answers

why javascript use call by reference , sometimes :D

Hello i lost about 4 hours debugging strange issue my work flow was var config = { someKey : [ 'valueA','valueB' ] }; function anAction() { // some code and loops like a maze, then async.each(config.someKey,function(configKey) { …
Bdwey
  • 1,813
  • 1
  • 16
  • 18
0
votes
0 answers

Java copies whole object when passed in function?

My question resembles a lot the battle between "is java pass-by-value or pass-by-reference". But I still can't understand what happens when I pass an object in a function. For example let's say that I have a huge HashMap and I want it to be…
jojoba
  • 554
  • 9
  • 19
0
votes
4 answers

Call by reference-or- Call by value

class Box { int size; Box(int s) { size = s; } } public class Laser { public static void main(String[] args) { Box b1 = new Box(5); Box[] ba = go(b1, new Box(6)); ba[0] = b1; for (Box b :…
Programmer345
  • 540
  • 2
  • 15
  • 29
0
votes
1 answer

Can I insert an object by value (copying) from one std::vector to another?

(I realized that it was a copy-paste-mistake in my program. But the reason, why I get exactly that error message could still be interesting for somebody else, therefore, I updated the question.) I have the following code snippet which copies the…
Michael
  • 7,407
  • 8
  • 41
  • 84
0
votes
7 answers

Why use call-by-value in C++?

What is the purpose of having parameters as call-by-value when it is more efficient to use call-by-reference? (For non-primitive data types.) Also, what if one was to add the const tag to call-by-reference parameters so that they won't be modified?…
user3334960
0
votes
2 answers

Is UML DataType passed call-by-value like C# structs

I have a question regarding UML DataTypes. The UML Superstructure says: A data type is a type whose instances are identified only by their value. If I understand this correctly it means, equality is checked by looking at the values of all…
jsf
  • 913
  • 3
  • 14
  • 22
0
votes
3 answers

python integer argument value is not changing even though id() is same in calling and called functions

def func(x): print "inside function" ,id(x) x = 2 x = 50 print "outside function" ,id(x) print 'Value of x before function call is', x func(x) print 'Value of x after function call is', x output: outside function 6486996 Value of x before…
user1423015
  • 593
  • 1
  • 4
  • 12
0
votes
1 answer

Call-by-reference and Call-by-value

I am writing a program that lets the user input an integer into the variable value, and calls the two alternate functions, each of which triples the chosen integer value. The function triple_by_value passes the variable number by value, triples the…
Leo
  • 67
  • 1
  • 1
  • 9
0
votes
1 answer

Call by value, name/reference, need in ML

I am studying for a final, and I have a practice problem here. The question asks for the result of val y = ref 1; fun f x = (!y) + (x + x); (f (y := (!y)+1; !y)) + (!y); under the following parameter passing techniques: Call by value Call by name…
0
votes
1 answer

TypeScript Call-by-Reference Confusion

Folks, while familiarizing myself with TypeScript, I ran into serious troubles getting a straightforward LinkedList implementation to work properly. Here's the source code - I'll describe the problem in detail below. class LinkedList { …