• Re: Demonstration of Dual Semantics Forth

    From Ruvim@21:1/5 to Ruvim on Mon Oct 24 19:23:48 2022
    On 2022-10-24 19:16, Ruvim wrote:
    [...]


    If you want a test, it's following.

    Let us have the helpers:

      : leave-compilation ( -- ) postpone [ ;
      : enter-compilation ( -- ) ] ;

    The behavior that the Forth system demonstrates when the text
    interpreter encounters the word name "foo" in compilation state can be identified by the execution semantics of the following word:

      : behave-via-evaluate ( i*x -- j*x )
        enter-compilation \ start in compilation state
        s" foo" evaluate
        leave-compilation \ revert interpretation state at the end
      ;

    The behavior of your test can be identified by the word:

      : behave-via-name-compile ( i*x -- j*x )
        leave-compilation \ ensure interpretation state
        s" foo" find-name name>compile execute-foo
        leave-compilation \ ensure interpretation state at the end
      ;

    We ensure interpretation state at the beginning of this word since your
    test is started in interpretation state:

      s" foo" find-name name>compile execute

    For the sake of simplicity, the input source was not made identical in
    these two ways of performing the behavior, but it can easy corrected.


    According the the term definitions for the term "compilation semantics",
    the words "behave-via-evaluate" and "behave-via-name-compile" should
    always produce the same effects (with mentioned reservation about
    different input sources).

    ... regardless how "foo" is defined, if it can be a part of a standard
    program, and there is no ambiguous conditions.


    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to Krishna Myneni on Mon Oct 24 19:16:25 2022
    On 2022-10-21 15:11, Krishna Myneni wrote:
    On 10/21/22 06:23, Ruvim wrote:
    On 2022-10-20 22:01, Krishna Myneni wrote:
    On 10/20/22 15:25, Ruvim wrote:
    [...]
    And it's an expected behavior for your test, regardless how a word
    "foo" is defined. Isn't it?

    Regardless how the word "foo" is defined, should your test demonstrate
    the same behavior that the system demonstrates when the Forth text
    interpreter encounters the word name "foo" in compilation state?


    Perhaps you can pose your question in the form of a test, using only
    standard words, so that there is no possibility of misunderstanding.


    Actually this my question is close to my another one[1], where I ask for
    a counter example to my statement. Maybe that question is more clear for understanding.

    [1] Re: POSTPONE and semantics of immediate words, 2022-10-20 19:26Z news://tis7e6$bmv6$1@dont-email.me https://groups.google.com/g/comp.lang.forth/c/rjbRkJPLMpY/m/UwKFSswDAAAJ



    My point is that for *some* definitions of "foo", and your test in interpretation state:

    s" foo" find-name name>compile execute

    this test on your Forth system (and many other) demonstrates a behavior
    that is substantively distinct from a behavior that the Forth system demonstrates when the text interpreter encounters the word "foo" in
    compilation state. (even with reservation concerning the different input source, that can be easy made identical).


    Whether such a difference is acceptable or not (according to the current wording of the "name>compile" glossary entry) depends on understanding
    of the "compilation semantics" notion (see the mentioned thread
    "POSTPONE and semantics of immediate words").





    -----


    If you want a test, it's following.

    Let us have the helpers:

    : leave-compilation ( -- ) postpone [ ;
    : enter-compilation ( -- ) ] ;

    The behavior that the Forth system demonstrates when the text
    interpreter encounters the word name "foo" in compilation state can be identified by the execution semantics of the following word:

    : behave-via-evaluate ( i*x -- j*x )
    enter-compilation \ start in compilation state
    s" foo" evaluate
    leave-compilation \ revert interpretation state at the end
    ;

    The behavior of your test can be identified by the word:

    : behave-via-name-compile ( i*x -- j*x )
    leave-compilation \ ensure interpretation state
    s" foo" find-name name>compile execute-foo
    leave-compilation \ ensure interpretation state at the end
    ;

    We ensure interpretation state at the beginning of this word since your
    test is started in interpretation state:

    s" foo" find-name name>compile execute

    For the sake of simplicity, the input source was not made identical in
    these two ways of performing the behavior, but it can easy corrected.


    According the the term definitions for the term "compilation semantics",
    the words "behave-via-evaluate" and "behave-via-name-compile" should
    always produce the same effects (with mentioned reservation about
    different input sources).



    --
    Ruvim

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