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

Question about "array" variables in XPL



On about about page 311 of Herbert Tyson's XyWrite Revealed book, Herb reveals a pair of XPL
programs SAVE100.PM and GET100.PM. Basically, what save100 does is, you define some text on some
page, invoked save100, it prompts you for a number between 201 and 300, you enter 201, and save100
stashes the defined text in S/G 201. get100 is similar, but you get the data back from S/G 201 (for
all values of "201" from 201 to 300)

Okay, fine, in save100, (I presume) Herb parses the number you entered, places in save/get 01,
places the marked text in S/G 20 and, as one reads the macro's text from the book, one sees about
100 lines that look like (using < and > for guillemets):

<if<pv01>==233><sx233,<is20>><glend><ei> 
<if<pv01>==234><sx234,<is20>><glend><ei>
<if<pv01>==235><sx235,<is20>><glend><ei>

If I want to make these macros save to any of 500 Save/Gets, I get the same thing, but then I need
500 lines like the ones shown, if I stick to Herb's design.

The reason for so many lines of code, and the way the number increases from 100 lines to 500 lines
is of course because XPL doesn't have the concept of "arrays" that most languages have.

So my question is, has there been any discussion here about ways to give us the kind of function
that Herb does, but without the code growing in proportion to the number of Save/Gets that I want to
support. In other words, a technique that works like arrays do in most languages. And, if so, could
anyone give me a pointer to that discussion.

Thanks for anyone who wishes to discuss or add knowledge on the topic.

Wally Bass

PS: BTW, I prefer, and still use, Xy3 Plus 3.57. I have my own ideas on how to do what I asked for,
but I'm curious about what alternatives have been suggested over time, for this general problem of
"array like" access. I'm also curious as to whether there is any interest in this kind of
question, given that, I do believe, XyWrite is getting fairly old (but is still the greatest).