2024-12-15 04:17:55 Yeah, that might as well be FORGET. 2024-12-15 04:18:13 Or marker or whatever your system does in that situation. 2024-12-15 04:18:56 I write my stuff so that :: creates words that will later be unlinked, while : creates words that stick around. 2024-12-15 05:15:39 that's an interesting idea! So the external interface is marked at the point of definition, as in Golang with its capital letters 2024-12-15 05:15:51 (or as in C++ with "public") 2024-12-15 06:19:09 Is there a standard way of creating custom words, i.e. name from a string instead of input? 2024-12-15 06:22:15 evaluate is it.. 2024-12-15 10:47:10 KipIngram, xentrac: We have this same discussion every time this is mentioned lol, the point is to use this to unlink words that are still used elsewhere but shouldn't appear to the interpreter/compiler anymore 2024-12-15 10:49:10 smlckz: If the source is a string then EVALUATE is necessary, in a traditional Forth I would consider putting it in a BUFFER and LOAD'ing if there was no EVALUATE available 2024-12-15 10:50:53 If the string is being read from the code then you can obviously use CREATE and : inside your 'defining' word, as well as WORD or PARSE 2024-12-15 12:13:49 veltas: Yes, I get that. I was just agreeing with xentrac's comment. 2024-12-15 12:15:08 smlchz: Some systems define (CREATE) or something like it - usually it's along the lines of : CREATE BL WORD (CREATE) ; 2024-12-15 12:16:18 veltas: I think some ability to do what you described is hugely useful, especially if you tend to factor really heavily. 2024-12-15 12:16:43 Sometimes factored words are long term useful, but often they're not. 2024-12-15 13:21:30 In Chuck's earliest systems colon "definitions" were handled as recursive text substitution, so what looked like a set of short factored definitions still wound up compiling as one long one. That would still be a way of approaching this (definitions that were only used the one time could be text substituted instead of being compiled separately), but you would have to be careful about the 2024-12-15 13:21:32 difference that would make to the return stack. 2024-12-15 13:39:54 veltas: yeah, I was just saying that zelgomer's scope end-scope proposal isn't sufficient to unlink words that are still used elsewhere. except I guess you could leave an xt for them on the stack or something 2024-12-15 13:41:42 if you added a public or something to it you could make it work. and you don't really need yournamehere 2024-12-15 13:42:41 consider scope : foo ... ; : bar foo ... ; public : baz swap bar ... ; ( 1) end-scope ( 2) 2024-12-15 13:43:48 here at 1 you would have all of foo, bar, and baz in scope, but at 2 only baz (though it could still refer internally to the others as usual) 2024-12-15 13:45:24 public could apply to either the following definition or to all following definitions 2024-12-15 13:46:29 this is more or less how vocabularies are used in F83 IIRC 2024-12-15 13:47:18 first you have some private definitions, then some public definitions that use them but are placed in a separate interface vocabulary 2024-12-15 13:48:15 and then you remove the private vocabulary from the search order 2024-12-15 13:49:29 I think you need some such flexible way to enter and exit these modules for the conventional interactive experimental Forth experimentation workflow 2024-12-15 13:54:55 why is mine not sufficient? 2024-12-15 13:58:27 scope creates a word and records the link before it, then pushes itself. end-scope finds the scope on the stack and records to it the latest link. when you execute the word, it finds the word that links to the word before end-scope, and replaces its link with the word before the scope was created. 2024-12-15 14:00:31 there are a hundred different ways to do this. KipIngram does it by tracking metadata with the word itself, veltas does it by explicitly specifying ranges. 2024-12-15 14:02:01 i don't like the explicit range because then i have to update the range if i add or remove or rearrange definitions 2024-12-15 14:03:11 and if it can be done without metadata or different colon words then i'd prefer that 2024-12-15 14:04:20 in one of my early forths years ago, i actually did the inverse. after loading a file, everything that wasn't marked with "export" was unlinked 2024-12-15 14:05:11 export came after the word like immediate 2024-12-15 14:05:38 just felt a little verbose to me so i quit doing it 2024-12-15 14:20:09 more recently i've been using the vocabulary shuffling method, it's just very cumbersome and wordy, especially so since vocabularies and the words to manipulate the context stack are a little janky. i just want a terse, clear, convenient error-free way to switch back abd forth between privates and publics so that i can interleave them, grouping module-private words near the top, and more word-local 2024-12-15 14:20:15 private words near where they're used 2024-12-15 21:18:08 I'm still not sure how much I like UNLINK , but so far it feels good to me 2024-12-15 21:18:16 You're right about the downsides though 2024-12-15 21:18:29 I'm hoping I can write code in a way so they're not downsides, or not big downsides 2024-12-15 23:39:44 zelgomer: I must not be understanding what you're saying. my understanding is that in your proposal if I say scope somename : foo ... ; : bar foo ... ; end-scope ( 2) neither foo nor bar is accessible at point 2 2024-12-15 23:41:59 I've read "records the link before it, then pushes itself. end-scope finds the scope on the stack and records to it the latest link. when you execute the word, it finds the word that links to the word before end-scope, and replaces its link with the word before the scope was created." four or five times without being able to make any sense of it 2024-12-15 23:54:22 lol sorry 2024-12-15 23:54:43 at point 2, they're all still in the dictionary 2024-12-15 23:55:07 when you execute somename, then everything between somename and end-scope are unlinked 2024-12-15 23:55:45 it might make more sense if i actually implemented it 2024-12-15 23:56:32 oh, I see! 2024-12-15 23:57:23 so the equivalent of my example scope : foo ... ; : bar foo ... ; public : baz swap bar ... ; ( 1) end-scope ( 2) would be scope somename : foo ... ; : bar foo ... ; end-scope : baz swap bar ... ; ( 1) somename 2024-12-15 23:57:36 yes