trying my hand at implementing JonesForth for Cortex-M0 lets goooo

Follow

to anybody who's read JonesForth: why does he reserve 3 bits but only use two flags in the length byte (IMMEDIATE and HIDDEN)? Seems like words could be up to 64 characters long if only 2 bits are reserved.

· · Web · 3 · 2 · 0

@winduptoy words shouldnt be up to 64characters long :)

@eris I agree, but was considering adding namespace capabilities. Do you have any advice on building up a large dictionary of words that have conflicting names for different contexts? (e.g. ERASE - erase memory? erase display? erase user input? I can easily think of a million conflicts.)

@winduptoy namespace mechanisms are achieved through different mechanisms in forth (wordlists!)

in a forth project, if you have a name conflict, you can use a different name - erasing memory is more often than not zero'ing memory, or 0 FILL ing it (:p). erasing the display is generally 'clearing' (any number of words work here though! RUBOUT to clear maybe?) the screen. as for user input, i probably wouldnt have a routine for that

@winduptoy essentially; you shouldnt be reusing word names across projects, and if a name is taken, its not hard to find another that encapsulates the same meaning

@eris that totally makes sense for a single person, but what if I have a collection of code written by person A for domain X and unrelated code written by person B for domain Y, and they both happen to both define the same word? How would one implement a system that requires both and deals with the conflicting word(s)?

Thanks for your advice!

@winduptoy forth advice is to not blindly copy paste code from other projects; plan out code beforehand, and rename the words if it's really a problem (ctrl-f). if you want a mechanical solution, wordlists, but this is a planning and implementation issue, not a technical issue

@winduptoy forth philosophy: dont write hooks, slots, etc, dont solve problems you might have, solve problems you do have

@winduptoy gur last bit is used for gur lenmask flag, iirc it has something to do with skipping over hidden words

@winduptoy could just be an oversight. It does seem odd that there’s an unused bit in between the HIDDEN and IMMEDIATE flags. I don’t see any masking to look at that bit either.

Sign in to participate in the conversation
Merveilles

Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.