Pass by name and go through value languages

For my course in programming languages, I am trying to write some code fragments in languages ​​that use pass by name or pass by value-result, preferably by default, but any language that even supports any of them will be fine. However, I could not find a single language that supports any of them. Does anyone know a language that uses pass by value or pass by name? Preferably imperative language.

+6
parameter-passing programming-languages
source share
6 answers

Wikipedia article on evaluation strategy assumes fortan is supported by default. Call-by-name is supported by algol 68.

+3
source share

I think that C Macros pass by name ( not the C language itself). I don’t know any cross-meaning languages ​​that I'm afraid of (to be honest, I had to do a web search to find out what that means!).

+1
source share

if you pass a variable to the fortran function and you modify it, you can also change it in the calling program:

psuedocode:

int j = 1 print j addOne(j) print j 

outputs:

 1 2 
+1
source share

I think the language of the CLIPS expert system will pass by name.

+1
source share

Both Java and C are the default languages.

C is obviously a language of transition by value.

Java always says that "primitives are passed by value, objects are passed by reference." But since the java object is a reference at any time, therefore it is a reference value.

The Java language specification reports the following: http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#37472

0
source share

Algol supports pass-by-name, as you can find some explanation here

I was told that Ada supports pass-by-value / result, but has not been tested yet.

0
source share

All Articles