As we know, some processes will complete.

void func (var a) { Console.WriteLine(a) };

And some will not,

void func (var a) { while (true) { Console.WriteLine(a) } };

What do we call the function that completes?

What do we call the function that never completes?

closed as primarily opinion-based by gnat, Doc Brown, amon, 8bittree, Eric King Jan 30 '18 at 23:20

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    Broken, or bugged – mmathis Jan 29 '18 at 21:11
  • 3
    Not everything has to have a name. If there is a name for non-terminating functions in some subfield, that term will not enable clear communication with the majority of people outside of that subfield. Most programs do not feature infinite loops, so this isn't much of an issue. – amon Jan 29 '18 at 21:19
  • 2
    Hello Code Whisperer, do you have an actual problem to be solved? And askers here are expected to do some reasearch before they ask. For example, did you look tinto this Wikipedia article about infinite loops? If not, maybe it answers your question already? Or maybe you are looking for the term "termination of a process", which is often used in this context? – Doc Brown Jan 29 '18 at 21:19
  • In the context of multithreading, this can be called a task. – mouviciel Jan 30 '18 at 10:14
  • @mouviciel, a "function that never completes" is called a "task"? – Steve Jan 30 '18 at 14:55

Rust refers to functions that have special syntax to indicate they do not return as “diverging functions”. The term comes from diverging sequences in maths, which are effectively infinite, never ending, sequences.

I’m not aware of another term for the same thing in other languages, so diverging functions or diverging processes seems a reasonable choice as a generic term for such functionality.

  • 2
    The term “diverge” is also used by B. Pierce in “Types and Programming Languages” in the context of typing recursive functions: In a Hindley–Miller type system, the function letrec diverge _ = diverge () has type Unit → T for all types T, and therefore diverge () is a bottom value for all types, e.g. undefined in Haskell. But this term is not widespread outside of Rust, type theory, or process calculi. See also: en.wikipedia.org/wiki/Divergence_(computer_science) – amon Jan 29 '18 at 22:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.