REXX
·3 mins

Every now and then I read an article about REXX, a scripting language designed at IBM and popularized on the Amiga. The authors of such articles generally enthuse about the language in a low-key kind of way, and I find myself wondering if maybe I should learn it. Then I go away and find a REXX FAQ and tutorial, and I read for a bit, and I realize that no, I shouldn’t. So for my own benefit (when I later archive and index this part of my journal), here’s a quick list of reasons why I should never go near REXX:
- Functions can’t return multiple values, nor can they modify their arguments. If you want to write a function which returns two values (say), you need to use a magic string which you think will never occur in either of them as a separator, concatenate, return the result, and then split it apart again.
- Whitespace is significant — it’s interpreted as concatenation. Hence mistyped or syntactically invalid statements are quite likely to be reinterpreted as some kind of concatenation of variables. (And I thought Python was bad.)
- Using an undefined variable is not considered an error. Instead, it just defaults to having a value that’s the same as its name, only in upper case. Truly foul, especially when combined with misfeature #2 above.So if (for example) you put whitespace between a function name and the brackets surrounding its arguments, it suddenly stops being a function call and becomes a concatenation of strings instead. Pass the barf bag.
- REXX normally guesses continuations, by assuming the next line is a continuation of the current line if the current line doesn’t look like a complete statement.
- Comma is used both to separate function arguments, and to indicate explicit continuation. So in spite of #3, you can’t just break a long list of function arguments across multiple lines — you have to turn the last comma on each line into double-comma, or you get something completely not what you intended. Ugh.
- You’re allowed to use variables that have the same names as words used in the language itself.
- Scoping is dynamic. Functions and procedures are just a hack whereby the system temporarily hides all variables except the listed ones, until it next hits a return. Not that you have to; it’s quite possible to write functions with overlapping scope.
- Forget about associative storage, REXX doesn’t even have arrays. You can simulate them with ‘compound variables’, but then there’s no type checking or bounds checking. If you want any, you have to write it yourself.
- You can’t pass arguments by reference. In fact, you can’t pass them by value either. Instead, you have to pass constants, and have the function or procedure use those constants to calculate the name of the variables it should use.
Still, I’m sure it’s better than JCL. Anyone want to convince me of the beauty of REXX, in spite of the above? If so, give it your best shot.