[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: XyWrite for Windows



** Reply to note from Harry Binswanger  Tue, 24 Dec 1996

> Robert wrote:
>> I know that XPL is, either, 1) very close to, or 2) identical to,
>> the actual way that XyWrite "thinks" and functions internally...
>> It's always best to speak the language of the machine, and not
>> emulate, translate, or thunk.

> Well, I can't buy the "translate" part, because, as many of you know, I
> created XyBasic, which allows you to write a pgm in a sort of Basic, and
> then run a translator which puts it into XPL. The final output is, of
> course, pure XPL (which you can edit as such, if you wish).

What, Harry, is the advantage of using your program if it generates code
which you wouldn't dream of using? Code which is prolix and slow and
archaic in its structure? If you have to edit it after you're done, using
the native language of XyWrite, then what's the point? If you're going to
familiarize yourself *anyway* with the molecular particles of XyWrite's
inner structure, like functions, what's the point? The *only* conceivable
advantage is Named rather than Numbered variables (S/Gs), which -- if you
really want them -- are incredibly easy to implement without XyBasic, and
always have been.

If anybody is interested, here's the basic technique, variants of which
which were rampant in Atex newsrooms back in rainy II+ days. Consider
the PFUN routine I posted earlier today. You simply give every XPL
Save/Get a discursive name, thus:

XPLeNCODE v1.9
b-gin [UNTITLED]
{<}IF{<}VA$WS{>}<>1{>}{<}PRNo file{>}{<}EX{>}{<}EI{>}{<}sxCur
sor_in_Text_or_Header,{<}VA$TX{>}{>}[SI_][BX_](pfun {<}PRPFUN
-ing...{>}{<}RC{>}{<}RC{>}{<}PR {>}){<}IF{<}pvCursor_in_Text_
or_Header{>}<1{>}[YD_][YD_][DF_][CL_][DF_]{<}svPFunction{>}[R
D_]{<}svLeftConcat,[CL_]{>}{<}svPeelOffThirdChar,[{>}{<}xsLef
tConcat,PeelOffThirdChar,FirstTwoChars,,Discard{>}{<}sxStripT
hreeCharsOffLeft,{<}isFirstTwoChars{>}+{<}isPFunction{>}{>}{<
}svWildX,{27}X{>}{<}xsStripThreeCharsOffLeft,WildX,Discard,,S
ignificantCharsofPFunction{>}{<}sxPut_PFunction,"[255+70+70]"
+{<}isSignificantCharsofPFunction{>}{>}[GH_]{<}gtPut_PFunctio
n{>}{<}EI{>}{<}EX{>}[cr|lf]

-nd
XPLeNCODE

When you're done, or throughout development, you run this type of code
through a filter (I'll post the filter I still use, very occasionally, if
anybody's interested), and -- voila! Executable code. With my filter
(there were several different ones), it comes out looking like this:

XPLeNCODE v1.9
b-gin [UNTITLED]
{<}IF{<}VA$WS{>}<>1{>}{<}PRNo file{>}{<}EX{>}{<}EI{>}{<}SX05,
{<}VA$TX{>}{>}[SI_][BX_](pfun {<}PRPFUN-ing...{>}{<}RC{>}{<}R
C{>}{<}PR {>}){<}IF{<}PV05{>}<1{>}[YD_][YD_][DF_][CL_][DF_]{<
}SV01{>}[RD_]{<}SV02,[CL_]{>}{<}SV03,[{>}{<}XS02,03,08,,10{>}
{<}SX06,{<}IS08{>}+{<}IS01{>}{>}{<}SV04,{27}X{>}{<}XS06,04,10
,,09{>}{<}SX07,"[255+70+70]"+{<}IS09{>}{>}[GH_]{<}GT07{>}{<}E
I{>}{<}EX{>}[cr|lf]

-nd
XPLeNCODE

When the numbers get *very* complicated, this sort of thing can be
temporarily useful -- e.g. debugging subroutines or modules of a larger
program. Your head stays screwed on. But basically, it's poor practice.
You entirely lose one of the unique strengths of XPL, namely reuseable
Save/Gets, which are very conservative of memory.

The issue is not whether Basic can be used, but whether it's an appropriate
language for the tasks at hand. I'm not convinced. But, obviously, TTG is
going to do it -- so we'll see.

---------------

Incidentally, the "translation" that XyBasic generates:

>255>BC va \XC LB .
LE +1>

is wordy. There are other problems also -- it doesn't generate "255
possible VA functions" (what are VA functions?); rather, it generates Error
Messages 1-255. Now why would I want to see 1-255 when there are 1300+
error messages? all a muddle -- but lets put that aside, along with the
ridiculous proposition that its better to translate than use machine
language, and let's just examine your "translated" result. This is faster,
cleaner, completely silent, no forward references, no loops, all operations
performed in memory (scandalous to do it on CMline!) -- in a word, modern:

GT +1>.{Tab}
+">>">

In short, if we must have Basic, then at least let's have one that is
written with a thorough grounding in XPL, and which we're entitled to shout
and scream about if it isn't economical or, worse, makes mistakes.


P.S. Out of town until 5 Jan. MX+HNY...


-----------
Robert Holmgren
holmgren@xxxxxxxx
-----------