news:3NKdnYNbSeRRrFzS...@supernews.com...
> On 5/26/12 2:02 AM, Rod Pemberton wrote:
> > "Elizabeth D. Rather"<
era...@forth.com> wrote in message
...
> >> The sequence OVER + SWAP is often defined as the word BOUNDS. Tastes
> >> vary as to whether this improves or impedes readability.
> >>
> >> A good clue as to whether a sequence is worth naming is whether it
> >> makes logical sense that could be captured in an English name, as
> >> opposed to some functional jargon such as O+S. This one is marginal :-)
> >
> > What ... ?
> >
> > So, for the OVER + SWAP sequence, you're _seriously_ telling me BOUNDS
> > makes more "logical sense" of what "could be captured in an English
> > name" than O+S?
> >
> > C'mon now ...
>
> As others have pointed out, BOUNDS conveys the *purpose* of the action.
> Good names reflect purpose and intent, not just a summary of details.
There is nothing in BOUNDS to convey that it is OVER + SWAP. One must
either know, look it up, or display it's definition. There is zero
information content as to what BOUNDS means when one reads "BOUNDS".
Good abbreviations convey the *meaning* of the abbreviation:
H2O - two hydrogen and one oxygen - water
ROFL - rolling on the floor laughing
HCl - hydrochloride
USD - U.S. dollar
TCE - tri-chloro-ethylene
Turducken - turkey, duck, chicken
TSP - tri-sodium-phosphate
Bennifer - Ben + Jennifer
> > Coming from an EE background, I know that abbreviations are by far the
> > best for that.
>
> Good abbreviations capture the *conceptual essence* of the thing being
> abbreviated, not an abstract shortening.
See above.
Look at the letters of the abbreviations.
Look at the letters of their meanings.
> A story about FETCH as pronunciation of '@': Originally that was
> pronounced "at" (i.e., that character is an "at sign"). At an early
> standards meeting a group of FIG members insisted on changing the
> pronunciation to "fetch" (for reasons I never understood), and outvoted
> the others present. I still think "at" would be better.
Um, "fetch" in the sense of "to retrieve" or "return with" being an antonym
to "store" in the sense of "to place" or "put away" was not something you
understood or considered ... Really? Their pairing is clearly a mnemonic
device. Abbreviations are too. Although, I think "load" and "store" were
more prevalent names in the 8-bit assembly era. Perhaps, he/she had
issues with the word: "load".
> And I distinctly remember teaching a Forth class in England in the 80's.
> I had a lot of examples on the board, when someone (who had evidently
> not been paying attention and suddenly woke up) asked, "What are all
> those bangs?" What? Where? Eventually, someone explained that ! is
> pronounced "bang" in England.
"at" for @, apparently meaning an address pointer in this context, seems to
be contradictory to your statements above. "at" doesn't convey the
"*purpose* of the action" nor the "*conceptual essence*". But, "fetch"
does... "at" just conveys an address, but doesn't convey the operation of
retrieving what is "at" that address.
It's called a "bang" for Unix shell scripts too, Fido-net email routing,
etc. Perhaps, he/she also had issues with the word: "bang".
> > I.e., I'm not buying into your argument here.
>
> On the contrary, you're presenting it well. < and > are commonly
> understood symbols, and hence better than .LT. and .GT. On the other
> hand, LSHIFT conveys the action better than << which could be
> interpreted as, for example, "much less than" or a beginning of a string
> << ... >> or a variety of other purposes.
>
... just as @ being interpreted as meaning "at" ... ;-)
Someone must define a meaning for symbols.
> >> ...I do see a lot of what you're calling "wrappers". But I'm
> >> disagreeing with the style of programming that would use *any* of
> >> these words, with the exception of +! (which is normally defined as
> >> a code sequence, both shorter and simpler than the high-level mess
> >> above).
> >
> > Ah.
> >
> > So, if Forth mostly doesn't have words to manipulate VARIABLEs
> > stored in memory, where/how do Forthers use VARIABLEs?
> >
> > Do Forthers always copy a variable's value to the stack, manipulate,
> > re-store? Isn't that a waste? (time, re-typing, cut-n-paste, etc)
>
> The whole point is that a value 'lives' on the stack, not in memory. If
> you are performing a sequence of operations on a value, it will be
> passed on the stack through the words that act on it, and not stored in
> a variable between each of those actions.
>
> Your example sounds a little forced to me...
If the words I posted were implemented as primitives (or low-level words),
then they need not use the data stack at all. So, I see the use of the
stack as contrived when one wants to manipulate memory data. It's an
unecessary intermediate step that prevents proper optimization of assembly.
You are aware that most microprocessor's since 1974 can directly manipulate
memory locations with arithmetic operations, yes?
> In most languages you can't operate on a value unless you give it a
> name.
True. Most are derived from C, or ALGOL, ...
> So, one naturally learns to think about values as named variables.
AIR, I learned mathematics before programming, where values were manipulated
without naming at first (basic math), then with naming them later (algebra).
I learned 6502 assembly immediately after BASIC. So, I don't see that
naming variables as logical outcome of thinking about values. In a language
with variables, the compiler can place data where most appropriate: stack,
memory, or register. The compiler can keep track of it's location without
programmer intervention. That's a good thing. The assembly can be made
more efficient. The programmer can't make mistakes about where the data is
located.
> This is an example of the different thinking that's required to use
> Forth effectively. Forth encourages you to approach processes differently.
That's called being devoid of a type system. That is usually considered to
be a security risk. I.e., someone retrieves a variable's value onto the
data stack, mistakes where it is, and stores it back to the variable in the
wrong location. The control-flow stack is another security issue.
Normally, "safe" high-level languages don't allow users to directly
manipulate control-flow data. When they can, they cause crashes and
breaches, e.g., see numerous buffer-overflow exploits for C. R> and >R etc
would have to be removed from Forth or use a 3rd stack.
In regards to Forth and my questions about it, what I'm seeing is a language
which has no self-imposed ideology, because it has no required language
syntax. However, I'm also seeing a language which has programmers who are
imposing currently or have imposed specific ideologies over time on the
language, thereby limiting the way it's used and it's potential. Some of
those ideologies, I would list as:
"factor words, but only when it doesn't conflict with other goals"
"use the stack, not variables"
"use words, not symbols or abbreviations"
"avoid state-aware words"
Rod Pemberton