Sujet : Re: Naming conventions
De : ruvim.pinka (at) *nospam* gmail.com (Ruvim)
Groupes : comp.lang.forthDate : 13. Oct 2024, 08:51:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vefu5m$jhmm$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
On 2024-10-13 09:27, dxf wrote:
On 13/10/2024 3:10 pm, Ruvim wrote:
On 2024-10-13 06:59, dxf wrote:
On 13/10/2024 1:20 pm, Ruvim wrote:
On 2024-10-13 05:13, dxf wrote:
On 13/10/2024 12:54 am, Ruvim wrote:
On 2024-10-12 05:45, dxf wrote:
The basics:
>
: .BAD ( -- ) cr ." Invalid item" .abort ;
>
: ZE? ( x -- ) if .bad then ; \ abort if non-zero
: NZ? ( x -- ) 0= ze? ; \ abort if zero
>
Typically, if word name ends with a question mark, the first (top) output parameter of the word is a *flag*. And it's true for all standard words. (though, opposite is not true)
>
It's rather similar.
>
ZE? NZ? destructively tests TOS
>
But these words do not return a flag in the first output parameter. So, their names violate the common convention.
>
Conventions are a guide. Thankfully they're not yet a law.
>
>
Sure. But the mentioned conventions seem good.
>
If you are proposing generally useful words, and their names violate a common convention, you could probably explain why it is not worth following that convention in this case (or in general).
Convention means doing something in a consistent way unless there's a reason to do
otherwise.
And what is your reason?
The standard had no qualms defining the word ? which leaves no flag.
The word `?` in the standard can be explained by a historical accident that occurred in ancient times. Moreover, this word is almost not used in programs.
Your case cannot be explained by a historical accident ;)
I don't feel any less entitled coming up with names that are short and to the point.
Feelings are not the best argument regarding names and conventions ;)
-- Ruvim