/**
 * This module provides a basic strategy for specifying
 * run-time verified strategies.
 *
 * @author Lennart Kats <lennart add lclnet.nl>
 * 
 */
module lang/with

imports
  util/log
  strategy/conditional

strategies

  /**
   * Evaluate a strategy s, or, if s fails, end with a fatal error.
   *
   * @note In future revisions, a facility may be provided to "catch"
   *       failures raised by with clauses and uses of this strategy.
   */
  with(s|message) =
    where(s <+ report-with-failure(|message))
  
  report-with-failure(|message) =
      ?term
    ; prim("SSL_stacktrace_get_all_frame_names")
    ; try(?["report_with_failure_0_1" | <id>])
    ; try(?["with_1_1" | <id>])
    ; report-failure(log(|Critical(), message, term); exit)