How about a language providing both callsigns and callsigns?

Is it good for the language to provide both an On Demand Assessment Strategy (CBN) and a callsign (CBV)? I mean, not fixing it and not modeling in one another, but letting the user choose when it is needed. For example, let the language have an eval function, as in an accessible Scheme, which can take one more argument from the user, indicating which evaluation strategy he wants.

+4
source share
1 answer

The compatibility of on-demand calls (laziness) and callsign (strictness) in a single language implementation is certainly possible if you try to avoid lazy calculations with side effects and make divergent calculations strict.

Constraint analysis is used in lazy (CBN) functional languages ​​to detect when functions can be safely evaluated using the CBV strategy. CBV evaluation is usually faster, but using this evaluation strategy for non-strict functions changes the semantics of the program.

Wadler describes how to combine lazy and rigorous computations in a functional language.

In the latter case, the problem also resolves the problem.

Scala has the lazy keyword to indicate that some calculations should be done lazily. Other languages ​​have similar constructs.

+6
source

Source: https://habr.com/ru/post/1341509/


All Articles