On 25/06/2021 9:03 pm, Jeremy Nicoll wrote:
isredit "(LRECL) = LRECL"
local lrecl = ispf.vcopy("LRECL")
Would that place the current file's lrecl in the ispf variable named
LRECL then copy that value to the lua program's same-named
variable?

If so, this is a lot more like writing an ispf application in assembler
than rexx - it may work, but it's a lot more cumbersome having to
move stuff between one's own local storage and the ispf variable
pools.


haha, comparing Lua to assembler is a new one on me.  You don't have to use vcopy. You can bind variables to a table which are lexically scoped. I prefer this to REXX where the global variable pool is populated from the ISPF implicit variable pool. I've been burned too many times by stem variables being polluted by global variables. REXX doesn't support lexical scoping. The best it has is 'procedure' which is pretty ordinary. It always makes me sigh when I see circumventions like wacky naming conventions such as stem.0varname.

There is a chapter in the Lua4z book that introduces Lua to REXX programmers https://lua4z.github.io/Lua4z/manual/rexx.md.html. One of the big differences is that Lua supports modules and classes so you can build large applications that share state via message passing. If I were to write an ISPF Lua application I would have a module for each panel display with the variables encapsulated in the class. You can't do that in REXX. In fact you can't even pass a stem variable to a external routine. And stem variables are extremely limited as REXX doesn't have any form of introspection. Also, REXX lacks data structures. All it has is stem variables and stacks. Stacks are lame, there can only be one active stack at a time. Why wouldn't they just support named stacks? Lua has libraries for binary trees, skip lists, linked lists, priority queues etc, etc.

It's not all bad though. I've recently been experimenting with REXX SDSF shell scripts where I can pipe the output to Python so I can write full screen curses applications in z/OS UNIX.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to