,---------------. | Contributions | `---------------´ ,------------------------------------------ | 2021-11-22 17:37:54 StephenPelc wrote: | example - New Line characters in a string passed to EVALUATE | see: https://forth-standard.org/standard/core/EVALUATE#contribution-217 `------------------------------------------ How should evaluate handle a string containing two lines of source text separated by a new-line? ,---------. | Replies | `---------´ ,------------------------------------------ | 2021-11-10 18:36:28 ruv replies: | proposal - PLACE +PLACE | see: https://forth-standard.org/proposals/place-place#reply-778 `------------------------------------------ ### 1\. Problem of overflow The "Rationale" section says: > The application must take care of any string overflow situation where the length of the resulting string would exceed the maximal length that can be stored in a length character. Also it has to assure that the memory is available to store the resulting string. But the "Typical Use" section doesn't show how to check for overflow, especially when `+PLACE` is used. Could you please fill this gap? The most robust behavior for an application in a case of overflow is to throw an exception. It seems, these words are useless when an application needs to throw an exception if a string doesn't fit a target buffer. I think, the following words can be far more useful and less error prone (their names are placeholders): `place-counted ( c-addr1 u1 c-addr2 u2 -- )` `+place-counted ( c-addr1 u1 c-addr2 u2 -- )` Where `(c-addr2 u2)` is the target buffer starting address and size. These words should check for overflow and throw an exception if any. In their turn, the words `place` and `+place` just encourage a bad practice since almost nobody checks for overflow when uses them, I think. So it's better to not include these words into the standard. ### 2\. Specify what instead of how I support the Anton's idea that we should not specify how to copy the characters, i.e. "from lower addresses to higher addresses". In this regard, these words should be similar to `MOVE` rather than to `CMOVE`. So it's better to specify the result, and don't specify how to achieve this result. The reference implementation should be corrected accordingly (i.e. store the length character after copy the characters). ### 3\. Note concerning char size It seems, in the subsection "Restriction on the Length of Counted Strings", “1 CHARS = 1 byte” is assumed. But “1 CHARS = 1” means that the size of 1 character is 1 **address unit** (not 1 byte). For example, an address unit may be 2 bytes. In this regard, it's unclear what does the phrase "Requesting standard systems to have byte size characters limit counted strings to the known maximal length of 255 characters" mean. ,------------------------------------------ | 2021-11-11 01:52:55 agsb replies: | referenceImplementation - Portable implementation for POSTPONE | see: https://forth-standard.org/standard/core/POSTPONE#reply-779 `------------------------------------------ POSTPONE must **always** occur between : and ; ? ,------------------------------------------ | 2021-11-11 06:25:12 ruv replies: | referenceImplementation - Portable implementation for POSTPONE | see: https://forth-standard.org/standard/core/POSTPONE#reply-780 `------------------------------------------ In general, `POSTPONE` may occur (may be referenced to) outside of a colon definition (`: name ... ;`). For example, with `synonym`: ``` synonym p postpone ``` But when it's encountered by the Forth text interpreter in a standard program, it may occur only inside a colon definition. ,------------------------------------------ | 2021-11-22 22:47:15 GeraldWodni replies: | example - New Line characters in a string passed to EVALUATE | see: https://forth-standard.org/standard/core/EVALUATE#reply-781 `------------------------------------------ To augment Stephens question: is the 2nd test supposed to work? ``` : warp-c cr ." Wrapper-name: " parse-name type ." Forth-name: " parse-name type ; \ this one works cr ." TEST ONE" s\" warp-c wone fone" evaluate \ this one does not on all systems cr ." TEST TWO" s\" warp-c wone fone\nwarp-c wtwo ftwo\n" evaluate ```