문제

What is the name of the following programming paradigm:

Code is executed based on a set of logical tests resolving to true (the clause). The clause is comprised of operators and operands. Each operand is a value/object.

Instead of evaluating the clause explicitly, as is done in imperative languages (e.g., normal flow control like if(){}), the clause is declared and bound to the resulting code. When the clause is satisfied, at any point in the future, the code will execute.

So, it's basically a dependency tree that re-evaluates whether the code should execute whenever a dependency changes state.

E.g.,

when(a && b && c < 3 && d.changes())
{
  runThisCode();
}

I'm looking for a more formal name and definition, and I haven't come up with anything after searching for it. It's somewhere between declarative and imperative, but I've never seen a language or paradigm that lets one do this.

Thanks, Sean

도움이 되었습니까?

해결책

다른 팁

Sounds like a Rule engine to me. E.g. in Jess you can define such declarative rules and call into imperative or object-oriented Java code.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top