Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.forth    |    Forth programmers eat a lot of Bratwurst    |    117,927 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 116,305 of 117,927    |
|    Ruvim to Ruvim    |
|    Name-body equivalency    |
|    12 Mar 24 19:33:39    |
      From: ruvim.pinka@gmail.com              On 2024-03-07 20:53, Ruvim wrote:       > On 2024-03-07 20:18, minforth wrote:       >> Ruvim wrote:       >>       >>> The accepted proposal for quotations [1] specifies only compilation       >>> semantics for the words "[:" and ";]".       >>       >>> The expected interpretation semantics for "[: ... ;]" are ...       >>       >> Expected by whom?       >       > By me and many other people.       >       > Some Forth systems are actually implement these interpretation semantics       > (some of them for the case when the current definition is absent only).       >       >       >>       >> I'd rather prefer some error message on a stray [: or ;] (principle of       >> least surprise)       >       >       > According to the principle of least surprising, interpreting a       > definition name should be equivalent to interpreting of the definition       > body.       >       > And if they are not equivalent — it should be for some clear and       > convincing reason. For example, `exit` can be used only in a definition       > body.       >       >       > Let's take the definition:       > : foo [: 123 . ;] execute ;       >       > There is no a convincing reason why the following lines should not be       > observationally equivalent:       > foo       > [: 123 . ;] execute       >                     BTW, a fundamental property of a pure concatenative language is that in       the same lexical environment, *any* call to a definition can always be       replaced by the definition's body.              In Forth, it's not always possible, especially when a definition is used       interpretively (e.g., if it's name is encountered by the Forth text       interpreter in interpretation state) — due to some special words like       control-flow words, r-stack operations, parsing words, local variables,       etc, which impose corresponding restrictions on their use.              If it is not too difficult to implement a word or construct without such       restrictions, then it is worth implementing. Because it makes learning       and testing code much easier.              So, it's worth implementing interpretation semantics for such words as       `[']`, `[char]`, `c"`, `."`, `abort"`, `postpone`, "[: ... ;]", "if ...       else ... then", `>r`, `r>`, etc.              NB: R-stack operations shall affect a separate stack in their       interpretation semantics to avoid problems in edge cases in a       user-defined text interpreter [1].                     [1] https://forth-standard.org/standard/tools/SYNONYM#reply-703              --       Ruvim              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca