[Oberon] On Oberon Commands
Srinivas Nayak
sinu.nayak2001 at gmail.com
Sun Dec 23 20:02:33 CET 2012
Dear All,
From Project Oberon Book,
2.2.2. Commands
This tremendous flexibility seems to open Pandora's box, and indeed
it does when misused. The reason is that global variables' states
may completely determine and alter the effect of a command. The
variables represent hidden states, hidden in the sense that the user
is in general unaware of them and has no easy way to determine their
value. The positive aspect of using global variables as interfaces
between commands is that some of them may well be visible on the
display. All viewers - and with them also their contents - are
organized in a data structure that is rooted in a global variable
(in module Viewers). Parts of this variable therefore constitute
visible states, and it is highly appropriate to refer to them as
command parameters.
This is good, I am able to understand it.
One of the rules of what may be called the Oberon Programming Style
is therefore to avoid hidden states, and to reduce the introduction
of global variables. We do not, however, raise this rule to the rank
of a dogma. There exist genuinely useful exceptions, even if the
variables have no visible parts.
As I understood, we are using global variables, but these have visible
states. So better for using them as parameters to user commands.
There remains the question of how to denote visible objects as
command parameters. An obvious case is the use of the most recent
selection as parameter. A procedure for locating that selection is
provided by module Oberon. (It is restricted to text selections).
Another possibility is the use of the caret position in a text. This
is used in the case of inserting new text; the pressing of a key on
the keyboard is also considered to be a command, and it causes the
character's insertion at the caret position.
This says, caret position (which is seen on screen texts after pressing
left mouse key) can be interpreted as starting of a parameter list. Also
the text under selection (which we are able to make using right mouse
button on screen texts) can be interpreted as starting of a parameter list.
A special facility is introduced for designating viewers as
operands: the star marker. It is placed at the cursor position when
the keyboard's mark key (SETUP) is pressed. The procedure
Oberon.MarkedViewer identifies the viewer in whose area the star
lies. Commands which take it as their parameter are typically
followed by an asterisk in the text. Whether the text contained in a
text viewer, or a graph contained in a graphic viewer, or any other
part of the marked viewer is taken as the actual parameter depends
on how the command procedure is programmed.
Huh, here I couldn't understand, what is a marked viewer. Which one is
the equivalent of "keyboard's mark key" in IBM 102 style keyboard? How a
graph be input to some command? I am not able to understand this paragraph!
With thanks and best regards,
Yours sincerely,
Srinivas Nayak
Home: http://www.mathmeth.com/sn/
Blog: http://srinivas-nayak.blogspot.in/
More information about the Oberon
mailing list