Hacker News new | ask | show | jobs
by mafribe 400 days ago
> How the parameters are passed must be decided by the compiler, not by the programmer.

Consider the program

   def f(x):
      return 17
If omega is a non-terminating expression then the call

  f(omega)
might or might not terminate, depending whether the compiler uses a lazy or eager evaluation strategy. This freedom is not something I would recommend to a programming language designer.
1 comments

I have not encountered yet a programming language where it is unspecified whether the evaluation of expressions is lazy or eager.

This choice has too many consequences and it is pretty much impossible to understand how a program will behave, unless you know whether the evaluation is lazy, like in Haskell and the like, or eager, like in ML, LISP and in most other programming languages.

In a programming language with lazy evaluation, the programmer also does not specify how parameters are passed. Whoever implements a translator for the language will choose a parameter passing method, which for most parameters will be neither by value nor by reference, but it would be something similar to the ALGOL 60 parameter passing by name.