Skip to content

WATCH Dialect Notes

Brian Dickens edited this page Apr 15, 2019 · 7 revisions

WATCH Dialect

The WATCH dialect is based on experiments in "Ren Garden", which was a Qt-based Rebol project circa 2015. Features are being added to ReplPad-JS as they become technically feasible.

Evaluations of the watchlist happen each time the user is returned to the console prompt. So the watches are not updated while code is running. The code must complete, be canceled, or execution must stop at a breakpoint.

(Note: Cancellation and breakpoints are currently under construction in libRebol.js; running under the browser's rules presents new challenges for these features. See "On Giving libRebol.js More Powers than JavaScript" for some background reading.)

/ON, /OFF

These are instructions to show and hide the watch window. While the window is hidden, no evaluations will be run.

Any watch instruction will implicitly show the watch window if it is not shown already.

The reason that PATH!s are used to signal instructions vs. WORD!s is that watch on would have a different meaning, of watching the variable contained in the word ON. A PATH! with a leading slash is easy to type (no shift-key).

(Question: Should showing and hiding the window be different from enabling and disabling watches? How might terms like /SHOW or /ENABLE or /DISABLE come into play?)

WORD!

Watching a WORD! will watch the value of that word with that specific binding.

*(Question: How should watching words be done in a way that watches the word but rebinds it each time, to whatever typing in the console would produce at that moment? And should that be the default--given that it would work better with breakpoints by rebinding to the meaning of a variable in a new invocation of the same function? Hence watching foo would mean "watch whatever as if I'd typed foo in the prompt at each console stop", while watching @foo could mean "watch specifically that foo, with that binding"?)

positive INTEGER!

A positive integer asks to fetch the evaluative value in that slot number from the watchlist. So if from a fresh session you typed:

>> x: "hello"
>> watch x  ; X will show as item 1 in the watchlist
>> watch 1
== "hello"

The watchlist should not be re-evaluated until after the answer is captured. So if there is a fluctuation of the result shown, that shouldn't affect what is returned--it should be what you saw at the time the command was issued.

negative INTEGER!

A negative integer asks to delete that watch number. This will result in the existing watches being renumbered (For a more persistent way of referring to watches that survives renumbering, use TAG!)

To be continued...

(There's only one of the Ren Garden features implemented right now. This page is a placeholder, so there's something to put in the link for the HELP on WATCH.)

Clone this wiki locally