On Monday, June 27, 2016 at 3:56:25 AM UTC-7, lehs wrote:
> Is it possible to extract the nice locals from the novice pack in a few rows? I tried to figure out how it worked in GForth but couldn't.
It is not complicated. I just construct a string containing LOCALS| ... | and then I EVALUATE it. I have to push the local-name strings to the return-stack and then pop them off so they get put in LOCALS| in a backwards order to how they appeared in { ... } .
Anton used (LOCAL) instead of LOCALS| --- I wasn't able to do this because at the time I was using SwiftForth-v2 that has a bug in it causing (LOCAL) to crash the system when it is used. If you don't care about supporting SwiftForth-v2 however, you could use (LOCAL) and avoid the need to concatenate strings. Concatenating strings was easy for me because I already had <CSTR ... CSTR> available, but if you don't have any way to construct strings then you may want to avoid using LOCALS| and use (LOCAL) instead.
Why do you not want to use the novice-package? You INCLUDE this, then you get { as well as quite a lot of other good stuff too --- the { was actually a trivial bit of low-level code that I wrote many years ago --- I have a lot more now.