Do lazy imperative programming languages exist? If not, why not?

690 Views Asked by At

If I'm not mistaken, the concept of a "lazy imperative programming language" makes perfect sense.

For example, I envision that the following code should cause the program to print "7"

a <- 1
b <- a+5
a <- 2
print([b])

while the following code should cause the program to print "6"

a <- 1
b <- [a+5]
a <- 2
print(b)

and the following code should cause the program to print the string "a+5"

a <- 1
b <- a+5
a <- 2
print(b)

The idea is that [..] flattens an expression by performing an evaluation, using the current values of each variable.

Question. Do lazy imperative programming languages exist, and if not, why not? Is there any particular reason why they cannot ever exist?

0

There are 0 best solutions below