Proposal: Traverse-wordlist does not find unnamed/unfinished definitions

Accepted

This page is dedicated to discussing this specific proposal

ContributeContributions

AntonErtlavatar of AntonErtl [153] Traverse-wordlist does not find unnamed/unfinished definitionsProposal2020-09-01 17:41:58

Author:

M. Anton Ertl

Change Log:

Initial version

Problem:

Does TRAVERSE-WORDLIST find unfinished or nameless definitions?

Solution:

It does not.

Proposal:

Change

Execute xt once for every word in the wordlist wid,

into

Execute xt once for every named and findable word in the wordlist wid,

Discussion

This is a wording change. The use of "findable" is taken from it's use in the definition of ":" an DOES>. Possible problem: A shadowed word is not findable with FIND, FIND-NAME-IN etc, but may be reached with TRAVERSE-WORDLIST.

AntonErtlavatar of AntonErtlNew Version: Traverse-wordlist does not find unnamed/unfinished definitions

Hide differences

Author:

M. Anton Ertl

Change Log:

Initial version

Problem:

Does TRAVERSE-WORDLIST find unfinished or nameless definitions?

Solution:

It does not.

Proposal:

Change

Execute xt once for every word in the wordlist wid,

into

Execute xt once for every named and findable word in the wordlist wid,

Execute xt once for every named word that can be found in the word list wid,

Insert, before "TRAVERSE-WORDLIST may visit ..."

A word that used to be findable in the wordlist but no longer is (because another word with the same name has been defined in the wordlist) may or may not be returned by TRAVERSE-WORDLIST.

Discussion

This is a wording change. The use of "findable" is taken from it's use in the definition of ":" an DOES>. Possible problem: A shadowed word is not findable with FIND, FIND-NAME-IN etc, but may be reached with TRAVERSE-WORDLIST.

This is a wording change. The insterted sentence allows shadowed entries to be visited and reflects the sentence "Whether duplicated nodes are visited or not by TRAVERSE-WORDLIST is undefined." in the original proposal.

ruvavatar of ruv

What is a rationale to allow TRAVERSE-WORDLIST to miss nt for a shadowed word?

In any case, a Forth system cannot reuse the same nt for the different definition (i.e., that has the different behavior), since this nt (literally) could be already compiled by a program.

Also, for better reflection, TRAVERSE-WORDLIST should return nt for every word that was placed into a word list (and that wasn't excluded as the result of a word created by MARKER).

IIRC, years ago a kind of recognizer was suggested by Michael Gassanenko to access the shadowed words.

AntonErtlavatar of AntonErtl

The idea was that some system might have a hash table that contains each name only once (i.e., the latest definition). Of course, a system that implements MARKER or FORGET would not go there. There probably are no such systems, so if somebody proposes to eliminate this option, there may be little resistance, but I am reluctant to do this in this proposal, which is intended to just be a wording change.

ruvavatar of ruv

a hash table that contains each name only once

Yes, I see. A hash table may contain nt for the most recently created word among the words with the same name.

AntonErtlavatar of AntonErtlNew Version: Traverse-wordlist does not find unnamed/unfinished definitions

Hide differences

Author:

M. Anton Ertl

Change Log:

Initial version

2020-09-03 Shadowed words are now guaranteed to be visited (consensus of committee discussion)

Problem:

Does TRAVERSE-WORDLIST find unfinished or nameless definitions?

Solution:

It does not.

Proposal:

Change

In TRAVERSE-WORDLIST, change

Execute xt once for every word in the wordlist wid,

into

Execute xt once for every named word that can be found in the word list wid,

Insert, before "TRAVERSE-WORDLIST may visit ..."

A word that used to be findable in the wordlist but no longer is (because another word with the same name has been defined in the wordlist) may or may not be returned by TRAVERSE-WORDLIST.

Every word that used to be findable in the wordlist but no longer is (because another word with the same name has been defined in the wordlist) is returned by TRAVERSE-WORDLIST.

Discussion

This is a wording change. The insterted sentence allows shadowed entries to be visited and reflects the sentence "Whether duplicated nodes are visited or not by TRAVERSE-WORDLIST is undefined." in the original proposal.

This is a wording change. The use of "can be found" refers to "shall not be findable" in ":" and "allow it to be found" in ";". As a result, TRAVERSE-WORDLIST would no longer visit shadowed words. To address that, the inserted sentence guarantees shadowed entries are visited. The committee discussed whether it is guaranteed that shadowed words are visited, and reached consensus that the old wording already gives that guarantee.

Formal

ruvavatar of ruv

I would suggest to avoid "named word" pleonasm in "for every named word that can be found", since an unnamed definition cannot be found. I.e., if a definition can be found, then it certainly has a name.

A possible variant of this part:

"Execute xt once for every word that can be found,"

A possible variant that unites both corrections into a single one:

"Execute xt once for every word that can be found in the word list wid, and for every word whose name matches the name of a found word but placed earlier in this word list,"

The phrase "same name" is inappropriate since it doesn't take into account possible case insensitivity. However, names matching is described in 3.4.2 Finding definition names.

Also, the following typo can be corrected:

"words with the same name are called in the order newest-to-oldest (possibly with other words in between)"

?

"words with the <b>matched names are visited in the order newest-to-oldest (possibly with other words in between)"

AntonErtlavatar of AntonErtl

The proposal was voted on and accepted 10Y/0N/1A. The vote was closed on 2020-09-03. If you think that the voted-on version is unclear enough to be improved, you need to make a new proposal.

I think it is clear enough, though. "Named word" may be a pleonasm, but it is clear. The way that "same name" is used in the voted-on version makes it clear that all matching names are considered to be the same.

Concerning "are called": Yes, "are visited" is intended, so one could make another proposal for fixing that. But nobody seems to have been confused by "are called" yet.

Accepted

AntonErtlavatar of AntonErtl

If someone proposes another revision, one could write:

When a word becomes findable, it also becomes traversable. The word the stays traversable until it is deleted.

and then define the rest in terms of "traversable", in particular:

Execute xt once for every traversable word in the wordlist wid,

Reply New Version