• Jolt. Continuations and Threading. Re: JOLT: The Imperative FP Language

    From rockbrentwood@gmail.com@21:1/5 to David Neto on Mon Jan 8 16:39:18 2018
    On Tuesday, February 14, 1995 at 9:04:59 AM UTC-6, David Neto wrote:
    A very interesting article, Mark. However, I couldn't help but feel
    that most of the ideas were familiar to me.
    (1) JOLT
    JOLT is a purely functional language which provides a front-end for the
    Infinite Lambda Calculus. Its syntax is Imperative and includes the
    while loop, goto statement, assignment statement and even the procedure call.
    Yet, all of this is syntatic sugaring for the Lambda Calculus.

    Any of the usual denotational semantics for imperative languages have this property. For example, see Stoy's book _Denotational Semantics_.

    There is no published literature on the Lambda Calculus with infinitary rational (or even non-rational) terms. Not even now. This is novel. It by-passes (and even provides a universal underpinning to) the monad-based approach to threading.

    So, go ahead and implement JOLT. But take a look at Hehner's stuff first. Please.

    I will examine the research you cited. Things may be happening soon. I now have an operational framework in place for language design and implementation and am about to migrate it rapidly upwards.

    Some key ideas and in a few cases, additions to the original article that emerged in the intervening years...

    The representation of / conversion to the call-return semantics into the continuation model (which is really what infinitary terms yield) happens to be EXACTLY the same as one of the several "kernels" we're devising for the new algebraic reformulation of
    the Chomsky-Schuetzenberger Theorem (which itself -- in light of our results -- is really the fundamental theorem for a new framework of and for "context-free expressions" whose power and generality are applicable to the FULL category of "C-dioids" (for
    lack of a better term -- the category of idempotent semirings closed under and distributive with respect to least upper bounds of context-free subsets ... a development from one of my publications in 2008).

    The general principle is that corresponding to each statement S and continuation Q is an infinitary expression S,Q that represents the effect of S on the infinitary expression that Q corresponds to.

    Examples:
    (if (E) S) Q = E? (S Q): Q
    (while (E) S) Q = x: E? (S x): Q
    (goto x;) Q = x

    The goto-label itself denotes a continuation and in Jolt, continuations can be used like expressions.

    A subprogram p(a,...,b) has a continuation-passing form pS(a,...,b,pF) whose extra "continuation" parameter pF is connected with the return statement
    (return;) Q = pF
    and is bound at call time as
    (p(a,...,b)) Q = pS(a,...,b,pF).

    For value-returning functions f(a,...,b), the continuation is an "expression-with-hole"
    (E(...f(a,...,b)...)) Q = fS(a,...,b,(E(...()...),Q))
    with the contination-passing form fS(a,...,b,fF) having an "expression-with-hole" that is associated with the return statement as
    (return E;)Q = fE(E)

    But now there is a SECOND addition to all of this. In tandem with the continuation-passing semantics, is a small set of multi-threading primitives that essentially define a new paradigm in languages

    "spawn E" -- to spawn an expression E while continuing on
    "pause X" -- to pause on X
    "resume X" -- to resume what last paused on X
    "exit" -- to end the thread.

    What's new is this: the call-return system is REPLACED by the spawn-pause-resume-exit system and superseded by it, being embedded within it as specialized optimized combinations thereof:

    "return;" = "resume pF; exit;"
    "call p(a,...,b)" = "spawn p(a,...,b); pause pF;"

    "e(...f(a,...,b)...)" = "spawn f(a,...,b); pause e(...fF...)"
    "return E;" = "resume fF(e); exit;"

    This, too, is brought within the continuation-passing semantics -- and done so in such a way as to make possible to conversion not just of single-threaded programs and deterministic control flow structures, but also multi-threaded programs AND non-
    deterministic control flow structures (e.g. such as those that occur in Prolog).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)