Questions tagged [callbyname]
86 questions
0
votes
1 answer
VB6 CallByName woes
I want to do a CallByName for some Subs but I just can't get it to go.
Everything goes fine until execution reaches the CallByName, then I have problems:
Whenever I use Me, it complains about a compile error
And if I use frmMyServer, it says…

rlb.usa
- 14,942
- 16
- 80
- 128
0
votes
1 answer
`answers` is not invoked when mocking a method with `call-by-name` parameter
There is a class InvokeLater, the definition is like:
class InvokeLater {
def apply(f: => Any): Unit = {
// do something ...
f
// do some other thing
}
}
In specs test, I mocking it like:
val invokeLater =…

Freewind
- 193,756
- 157
- 432
- 708
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…

Davido Widre
- 185
- 2
- 13
0
votes
1 answer
Does a callbyname parameter has to be wraped in curly bracets on a funciton call?
In the coursera course Functional Reactive Programming Week 3 Lecture 4 Erik Meijer implements a retry function for a Future, which will retry a computation a given number of times. He specfies block as a call_by_name parameter since the Future…

dre-hh
- 7,840
- 2
- 33
- 44
0
votes
2 answers
Using callbyname to check list.contains(x)
I've been trying to use callbyname to write a generic function which checks if the target list (targetListName) contains a certain item before adding it to the list. Unfortunately, I can't seem to figure out how to use .contains with callbyname. …

PostalElf
- 15
- 1
- 6
0
votes
0 answers
Call-by-name evaluation and foreach loop
I faced this problem for the first time and I can't figure it out.
Let's say we have an array and a foreach loop.
Something like this:
var v = array(10,20,50);
var i = 0
write(foo(v, v[i++]));
function foo(ref int[] v, name int y){
foreach(int j…

joeguarino
- 1
- 1
- 2
0
votes
3 answers
Call by Name with dynamic scoping
I am stuck at the following problem on static/dynamic scoping:
The following program fragment is written in a programming language that allows global
variables and does not allow nested declarations of functions.
global int i = 100, j = 5;
void…

Ravindra S
- 6,302
- 12
- 70
- 108
0
votes
2 answers
Call by value, reference and name
Possible Duplicate:
Pass by Reference / Value in C++
I was wondering what the difference is between a call by value/reference/name. And why would it be beneficial to use one over another?

Chen Li
- 151
- 1
- 2
- 9
0
votes
1 answer
Mismatch between call-by-name parameter and function type
In the following scenario, by-name parameters cause conflict with functions.
Given some serialization infrastructure:
trait Tx {
def readSource[A](implicit ser: Serializer[A]) : Source[A] =
new Source[A] {
def get(implicit tx:…

0__
- 66,707
- 21
- 171
- 266
-1
votes
1 answer
Visual Basic: CallByName with multiple "Levels"
I've been working on this for quite a bit now but I still cannot get my code going.
I have a class called Contact which has a read-only property Address. The Address class has properties like Street and City. Now I want to assign a contact's street…

Jannes
- 19
- 5
-3
votes
1 answer
What is the result and example of invoking this function using "Call by name" in java or c++?
I just took a quiz for my programming languages class and came across this question:
Assuming call by name, what are the results of following code:
public class MyClass {
static int i = 1;
static float f(int x, int i){
int s = 0;
…

Remixt
- 597
- 6
- 28