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,809 of 117,927    |
|    Ruvim to minforth    |
|    Re: value-flavoured structures    |
|    27 Sep 24 16:27:18    |
      From: ruvim.pinka@gmail.com              On 2024-09-27 12:51, minforth wrote:       > On Fri, 27 Sep 2024 8:15:48 +0000, Ruvim wrote:       >> For example, it's impossible to change n to d, n to r, or vice versa,       >> without changing all the code accessing those fields.       >>       >> Similar for the word `to` — `to` applies to the words created with       >> `value`, `fvalue`, `2value`. But the source code around `to foo` (and       >> `foo`) depends on the kind of `foo`, so the kind of `foo` cannot be       >> changed without changing the source code around where it is used.       >>       >> Higher level (more polymorphic) source code in Forth is possible when       >> all values are boxed [1]       >       > I don't know what compiler you use, but my values and locals       > are certainly not boxed. TO et al (+TO *TO := *= ++ += *+) will       > inspect their type and generate the appropriate machine code       > without me having to change the source code if I change the type.              I said about the source code *around* the usage places.              For example:               0 value foo        \ ...        foo 1+ to foo              If we change the kind of `foo` to "floating-point" as:               0e fvalue foo              or to "double-cell" as:               0. 2value foo              then we should also updated all the places where 'to foo' or 'foo' is used:               foo 1e + to foo              or               foo 1. d+ to foo                            In this sense, the code is not polymorphic.                            --       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