I'm trying to understand what the difference between MARKER and FORGET "really" is (as opposed to just their behavior). I've been favoring MARKER over FORGET but in practice I'm not seeing an advantage (over personal preference): If one can remember a marker called "-wordName", then they can just do "forget wordName" rather than create the marker, then execute it. In either case, you lose all words defined after the marker or the word you're "forgetting". I don't know what the defined behavior of WORDS is (apart from "list words"), but it appears to list user-defined words in the order that they were defined. If in fact that's reliable, then we don't really have a concern or need to keep track of "where" in the dictionary a word is defined with a marker, we can just use WORDS and then use FORGET on a chosen word and see exactly what would be removed above it in the dictionary. In fact, I came came across my dilemma by often forgetting to use a marker before a definition and then just finding that I can use FORGET and get the same result. Additionally, in most source files I see a marker executed then reset at the beginning of the file. This seems dangerous to me unless you have a very strict system defining the order in which your source files (and especially, definitions) are loaded into Forth. So, apart from an aesthetic or personal preference, I don't see what MARKER can do that FORGET can't (and vice versa).
Now for a code example... I do understand how by using markers we can add dividers or "chapters" to our dictionaries that will make it look organized to another user (and to our future selves) when they do WORDS. However, we could replicate that by using dummy words. i.e. what would be the real difference between these two?
:-myWord( does nothing blank/stub/dummy);\ or "variable -myWord" :myWord."Execute some code";forget-myWord
and
marker-myWord:myWord."Execute some code";-myWord
Last edit: SJR 2023-06-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to understand what the difference between MARKER and FORGET "really" is (as opposed to just their behavior). I've been favoring MARKER over FORGET but in practice I'm not seeing an advantage (over personal preference): If one can remember a marker called "-wordName", then they can just do "forget wordName" rather than create the marker, then execute it. In either case, you lose all words defined after the marker or the word you're "forgetting". I don't know what the defined behavior of WORDS is (apart from "list words"), but it appears to list user-defined words in the order that they were defined. If in fact that's reliable, then we don't really have a concern or need to keep track of "where" in the dictionary a word is defined with a marker, we can just use WORDS and then use FORGET on a chosen word and see exactly what would be removed above it in the dictionary. In fact, I came came across my dilemma by often forgetting to use a marker before a definition and then just finding that I can use FORGET and get the same result. Additionally, in most source files I see a marker executed then reset at the beginning of the file. This seems dangerous to me unless you have a very strict system defining the order in which your source files (and especially, definitions) are loaded into Forth. So, apart from an aesthetic or personal preference, I don't see what MARKER can do that FORGET can't (and vice versa).
Now for a code example... I do understand how by using markers we can add dividers or "chapters" to our dictionaries that will make it look organized to another user (and to our future selves) when they do WORDS. However, we could replicate that by using dummy words. i.e. what would be the real difference between these two?
and
Last edit: SJR 2023-06-23
There is an explanation at flashforth.com.