Description
In #753 , @echeran brought up the example of a custom function getSystemTimeInMillisNow()
that would return the current time.
In the spec intro we currently have the language:
"This specification does not require either eager or lazy expression resolution of message parts; do not construe any requirement in this document as requiring either."
Consider the following example (which formats to a string with the current time repeated twice... or does it?):
.local $x = {:getSystemTimeInMillisNow}
{{{$x} {$x}}}
In an eager implementation, this is guaranteed to print the same time twice.
In a lazy call-by-need implementation, where the right-hand side of $x
is guaranteed to be evaluated at most once, it's also guaranteed to print the same time twice.
In a lazy call-by-name implementation, it may print out two different times.
In general, custom functions might have side effects observable by MF2, and getting the current time is a reasonable example of one. That means one can't assume that call-by-need and call-by-name are going to be equivalent.
I think all that's needed is an editorial note pointing out that depending on the contents of the custom function registry, call-by-need and call-by-name may be observably different and the implementor should think about which one is the least surprising.