Questions tagged [callbyname]
86 questions
0
votes
1 answer
Does F# support 'call-by-name' semantics?
For a while F# has supported the ability to auto-quote using []. Is there anything similar for laziness?
e.g.
member __.Quoted ([] quotation:Expr<'T>) = ...
member __.Thunked…

mazin
- 395
- 2
- 7
0
votes
0 answers
Call a function in another class by its string name, from a different class
Problem
I'm trying to call a method in a class by its name (as a string).
The mso object has the method exampleMethodName.
This works - I can successfully call a function by its string name.
String s1 = "test string 1";
String s2 = "test string…

Ian
- 3,605
- 4
- 31
- 66
0
votes
1 answer
Executing string as property to set values in SAP with VBS
I'm trying to automate a list of property set commands in SAP GUI 740, for example, to set the "text" property of a field to "12345" as shown below.
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application =…

Ross
- 97
- 4
0
votes
2 answers
Problem with Scala Function and Call-by-Name
I am trying to loop a the second parameter (exp) in this function that uses call by name parameters. The first 3 parameters are the index, boolean to stop loop, and increment function. I am getting an output with 10 '()'s when I am trying to loop…

gradstud
- 61
- 1
- 7
0
votes
2 answers
Haskell Semantics call by name / value
I am new with Haskell, I have a question
h x = x : (h x)
g xs = [head xs, head xs - 1]
What is the result of running g(h 2) assuming the semantics is call-by-name and call-by-value ?

Menma Yuna
- 35
- 1
0
votes
0 answers
Is normal order evaluation (call by name) further divided into call by value, call by reference, call by sharing, etc?
Consider different ways of evaluating a procedure call and its arguments.
Essentials of Programming Languages says
All the parameter-passing mechanisms (natural parameter passing, call by value, call by reference) we have discussed so far are…
user10082400
0
votes
2 answers
Difference between Call-by-name and Call-by-macro-expansion
Let's assume we have the following code in a language that looks a lot like C.
int A[2];
A[0]=4;
A[1]=7;
void f(int x, int y) {
x++; A[1]++; y++;
printf(x, y, A[0], A[1]);
}
void main() {
int k = 0;
f(k, A[k]);
…

MJ13
- 195
- 6
0
votes
2 answers
Tail recursion and call by name / value
Learning Scala and functional programming in general. In the following tail-recursive factorial implementation:
def factorialTailRec(n: Int) : Int = {
@tailrec
def factorialRec(n: Int, f: => Int): Int = {
if (n == 0) f else…

Jason
- 2,495
- 4
- 26
- 37
0
votes
1 answer
Differences between "call by name" and Function0 in Scala
What are the differences between f: => R and f: () => R ?
They seem to work in the same way, but their types are incompatible with each other.

atos
- 37
- 4
0
votes
2 answers
How will the output look if my program used call by name?
So this is my code and I know the output for call by value is
Here is f
main: z = 15
What would it be if a language used call by name instead of call by value?
int f() {
cout << "Here is f" << endl;
return 5;
}
int g(int a) {
int x =…

Bronia Berlin
- 119
- 6
0
votes
1 answer
callbyname vb6 using string as argument
I am trying to set some images's visibility to false by using CallByName and a loop through the objects.
here is the code
Private Sub command1Click
dim theobj_str as string
dim ctr as integer
for ctr = 1 to 3
theobj_str = "Images" & ctr
…

padjee
- 125
- 2
- 12
0
votes
2 answers
Difference between the execution of a+=2 and a=a+2?
void increment(int a)
{
a+=2
}
void assign(int a)
{
a=a+2
}
In which of the parameter passing technique a call to increment(b) will have a different effect
from a call to assign(b)
1) call by value
2) call by value result
3) call by…

Amrata Ramchandani
- 83
- 1
- 9
0
votes
3 answers
Scala class singleton with non-default constructor parameters
I have already read about issues with objects inheriting from companion classes.
For example:
Class constructor parameter with default value causes companion object initializer to fail
super constructor cannot be passed a self reference unless…

Andrii Abramov
- 10,019
- 9
- 74
- 96
0
votes
1 answer
Haskell pattern matching inside parentheses
I would like to define a function that operates on an expression of a certain type, but has access to its internal structure, if it has one. For instance, f in what follows:
g :: a -> a -> a
g x y = y
f :: a -> a
f x'@(g x y) = x'
f _ = 1
(g x y)…

Questionbeggar
- 3
- 2
0
votes
1 answer
Difference between call by name and call by text parameter passing mechanism with examples
Out of 5 types of parameter passing mechanism:
1.pass-by-value
2.pass-by-reference
3.pass-by-value-result
4.pass-by-text (macros in C)
5.pass-by-name (something like continuations)
I just want the difference between the last two.Please help…

Deepaank
- 1
- 1