Blog

REXX Monarchial Madness is Hereditary

So, I was trying to figure out how to manage global vs. local state, and made the dumbest program possible:

/** array.rexx */

a. = 0
a.0 = 10
DO i = 1 TO a.0; a.i = i; END

SAY array_string("a.") -- prints 1 to 10
SAY alen -- prints "ALEN" because it doesn't exist in global scope

EXIT 0

/* Returns string representation of an array, stem. passed as first arg. */
array_string:
    PARSE ARG _arrayvar .
RETURN _array_string()

_array_string: PROCEDURE EXPOSE (_arrayvar)
    alen = VALUE(_arrayvar || 0)
    str = ""
    DO i = 1 TO alen
        IF i > 1 THEN str = str || ", "
        str = str || VALUE(_arrayvar || i)
    END
RETURN str

So… I've made a global variable "a." full of numbers. PROCEDURE makes a local variable context until you hit RETURN; you should never work at global scope if you can avoid it. So to pass a. in, I have to bounce through a global function array_string(), set a global var _arrayvar to whatever arg was given, which calls a local function _array_string and the paren in EXPOSE (_arrayvar) expands that into "a.", and then use VALUE() to dynamically read the variable.

Well, it works. I remember now how crazy complex REXX programs got, with giant global databases being exposed in every function. I bet this is the origin of my "World object" pattern in so many later languages.

This and another dumb example or two ate a couple hours of my brain, but it kinda makes sense again, you know? Interesting for a language I haven't written in anger in 20 years. I went fully back to SHOUTING KEYWORDS, it just makes sense.

The Python version of this is:

#!/usr/bin/env python3

def array_string(arrayvar):
    return ", ".join(map(str, arrayvar))

a = []
for i in range(1, 11): a.append(i)
print(array_string(a))

Which I'd argue is just as stupid, because Python thinks ranges end 1 before the last number, doesn't know how to join numbers with strings, on a large array that map will consume all memory, and is a single-pass interpreter so I have to put the function above the script code; but it is much, much shorter.

REXX is Still the King

Random REXX mention on Fediverse reminded me of good times with it. REXX was originally a scripting language for the IBM /360 series, later OS/2 where I encountered it. There's three main branches: REXX (original, simple procedural language), ooRexx (strict superset adding OOP tools to REXX), and NetRexx (almost-REXX implemented in Java, so it can interact with the entire Java API).

The things it does well are: Simple notation, like BASIC, but it's structured and dynamic: Variables have their NAME as default value, and it's trivial to evaluate strings as code. Variables can also be "stems", either indexed or associative arrays depending on key. a.=0; a.0=10 and you have an 10-element array of 0's (using .0 as length is common). Any command it doesn't recognize is passed to the outside environment, which might be a command-line shell, another program you're scripting, whatever, no special syntax needed. REXX is preposterously fast for a scripting language, and has perfect decimal math (Cowlishaw's main academic area of interest), though it's still not compiled language fast.

OS/2 made great use of it. The E and E/PM editors written in REXX are all about scripting; like Emacs but far more so, there's almost no program except the E script.

Back in the '90s, I wrote a ton of programs for clients (all dreadfully dull line-of-business stuff) which were thousands of lines of REXX with VT100 UI or a little teeny GUI shell in C it controlled and got messages from; my turnaround on a business change could be hours instead of days or weeks for a C-only program. There's somewhere on FTP sites or in my old code archive my QUEST game, which was just a random D&D wilderness crawl hack-and-slash, written the same way, and a huge script for writing a nice config file to generate the impossibly fussy bit-twiddling world files for DikuMUD and CircleMUD.

Down side, by the late '90s OS/2 was shut down, Mike Cowlishaw started doing everything in NetRexx, so the core language languished, and there weren't good ports to Linux or Mac (either System 9 or early OS X). The open-source "Regina" interpreter was almost but not quite compatible, and was very frustrating to debug around. I completely gave up on it around 1999, when Python got usable.

Seems in the last decade they've somewhat recovered, REXX Language Association, aka ooRexx.org, and NetRexx all have maintained sites, the old RexxInfo site is as hideous as it was in the '90s, and unmaintained now, but does have a free copy of the REXX Programmer's Reference book which is nicely complete.

The RexxLA symposium is going on as we speak. No livestreams, sadly, but last year's presentation decks are up. You might want to start with Rexx Tutorial for Beginners part 1, part 2, and ooRexx Tutorial.

I'd really like to hear "Rexx from OS/2 to macOS - a travel in time & space"!

% sudo port install oorexx
…
% cat hello.rexx
/** hello.rexx */

name = input("What is your name? ")
say "Hello," reverse(name) || "!"
exit

input: procedure
    parse arg prompt
    call charout ,prompt
    return linein()

% rexx hello.rexx
What is your name? Mark
Hello, kraM!

Works fine. The default I/O commands are a little weird so I rewrote that input function almost from muscle memory. PULL var and PUSH x operate on a stack and get uppercased, PARSE PULL var is very powerful and lets you interpolate strings for parsing input (you can also use it on function args, as seen here), but here all I want is a complete line as a function. SAY is a cutesy form of CALL LINEOUT ,whatever, (the missing first arg to CHAROUT or LINEOUT is the output file name/handle). Note the two ways to call a function: y=f(x) or CALL f x depending on if it has a return value. I write everything lowercase, modern REXX is case-insensitive, but historically it was an uppercase-only language, so I always SHOUT THE KEYWORDS when talking about them.

I didn't get far into ooRexx back in the day; I don't think most of its "enhancements" are needed to a nice simple language, but there's places where stems aren't a sufficient abstract data structure and the like.

This looks like fun to play with again, though I wouldn't expect to ship anything useful in it. The one problem is there's no REPL. You can actually make a simple REPL with just DO FOREVER; PARSE PULL line; INTERPRET line; END but there's a lot of error-handling and structured stuff that won't work in that. I think I have a real REPL in my code? I'll go looking in a bit.

Safari 13

So I hit upgrade, and I regret everything.

Obviously, this is the release where they break Safari Extensions, they now have to be apps. uBlock Origin is dead. I've installed Ghostery Lite for the moment but I have no real solution for the future; "uBlock" is an ancient unrelated fork that allows advertising, fuck those criminal scum.

The other thing is tab management is broken: Cmd-T now makes a tab after the current, instead of at the end of the tab list, so now my tabs are all but unmanageable. I'm going to file a Radar, but throwing bits down the black hole isn't going to fix it I think.

Right now it's churning with CPU time being wasted on background tabs, and I'm hoping that's just because I rebooted and reloaded all my tabs, and not something it'll continue doing.

% cat safariCountTabs.applescript
#!/usr/bin/osascript
set output to ""
tell application "Safari"
    repeat with i from first window's index to last window's index
        set w to window i
        set output to output & "Window #" & w's id & " = " & (count w's tabs) & " tabs - "
    end repeat
end tell
do shell script "echo " & quoted form of output
% safariCountTabs.applescript
Window #178 = 125 tabs - Window #170 = 2 tabs - Window #172 = 6 tabs - Window #173 = 18 tabs - Window #174 = 24 tabs - Window #175 = 16 tabs - Window #176 = 35 tabs -

(AppleScript problem: If I use & return or "\n" instead of " - ", they get converted to ^M on output. Is there a setting to make AppleScript not think it's on a '90s-era Mac OS?)

Yeah, obviously I could change to another browser. But I hate every other browser. Chrome's created and operated by a criminal, advertising-supported organization. Firefox is just awful to use, because everyone at Mozilla uses Linux and hates users. Opera's not terrible, but it's not good, and just a wrapper over Chromium so probably just as corrupted as Chrome itself.

Raspberry Pi 4 Setup

In my long-running cyberdeck-building saga, I've tried a few variations. Now trying the new RasPi4-4GB from CanaKit, Rii K12 keyboard, and a very cheap terrible Elecrow 10.1" monitor. When I first got the shipment, the MicroHDMI-HDMI cable was missing, but CanaKit quickly shipped me two, in case I want to run two monitors on my very tiny computer. And then when I got everything hooked up… nothing happened. Turns out, the recommended format tool formats SD cards in ExFat, and RasPi only boots from FAT32. OS X's "new" Disk Utility is awful but did let me pick the right option, copied NOOBS, and was able to boot Raspbian! Yay!

Protip with the Rii keyboard: Little radio adapter is hidden in one of the feet. Took me a bit to figure out why it wouldn't pair. It's a weird layout, keys are a little mushier than I like (I like either classic buckling spring IBM or Northgate keys, or the thin super-crisp "Apple Magic Keyboard" keys), but it's attractive, great for the size, and the trackpad works better than I expected as a real mouse; I do have to hit the left-click keyboard button sometimes to wake it up. I may or may not stick with this forever.

I won't be staying in Raspbian, I hate Linux more than anything, but I don't want to fight with setting up BSD on a new device just yet. What I'd love is if Haiku worked on it, but BSD is probably a saner choice.

Uninstalled all the stupid stuff that's preloaded. LibreOffice can suck it, 10 different "simple IDEs" can fuck off. Mathematica and Wolfram Alpha can stay. "vi" is actually Vim, but "vim" is not installed; anyway I won't be working full-time in Vim. Did an adduser, installed zsh and chsh to zsh; fucking Lintwats still use bash after all the security holes! After some advice from Mastodon, Geany seems tolerable as a GUI editor, and it's cross-platform, good option.

There's a Chez Scheme package, but it didn't install anything and apparently is long out of date. Chicken only has the compiler, not a REPL. But Gauche installs, the "gosh" REPL runs fine, and seems to have working GL & GTK+ libraries, which may be a reasonable way to make some GUI tools for it.

Chromium is the standard browser, which whatever man, but it keeps bugging me to sign in, and I will never do that. It plays Youtubes OK, which is likely to be 75% of its runtime. I'm kind of impressed the sound works and I won't touch anything about that except volume because Linux + sound = 9th level of Hell.

I loathe the very simplistic Windows-like wm it starts with, haven't seen any "setting" to change that, probably have to go fight config files and Raspbian won't be here that long.

Now I need to finish the keyboard box, so I can make this portable, but as just a little desktop computer it's pretty sweet, and my setup cost me $220 total (plus some earlier experiments).

The New Annotated H.P. Lovecraft: Beyond Arkham

Excellent volume. Massively annotated, 1/3 sidebar is almost always full of red text. Mentioned people, places, and artworks are shown inline.

First volume covered mostly more popular stories (arbitrarily chosen as ones mentioning Arkham), but this has most of his Dream Quest, and "The Outsider", one of my favorite of his stories.

It's a big improvement over S.T. Joshi's fandom-oriented books, which had some blurry photos half-assed shoved in the text, no index, in one volume no table of contents!

"Men of broader intellect know that there is no sharp distinction betwixt the real and the unreal; that all things appear as they do only by virtue of the delicate individual physical and mental media through which we are made conscious of them"
—H.P. Lovecraft, "The Tomb" (1917)

The man himself was troubling, but he's long dead and the shadow of his writing has happily darkened the entire 20th & 21st Centuries.

I don't know why, but I'm really getting in the mood of endless Halloween this year, and a steady diet of horror helps.

Television Don't Touch That Dial (1982)

Fascinating time capsule. This was just as cable and videotape rental was devouring their market, and about 10 years before Twin Peaks (1990), Babylon 5 (1993), and Murder One (1995), the first scripted season shows on US television (not counting soaps, which generally didn't have plots so much as random encounters).

So they knew that episodic garbage with ad breaks getting longer and more frequent was toxic, for most of a decade, and they still couldn't fix it; they just went to cheaper and worse shows every season until it imploded. ABC, CBS, and NBC are still around, still making the same crap that only very old people watch anymore (the few plausible viewership charts I've found show over-50s a steady market for watching broadcast TV; Gen-X and younger just vanishing from their charts), many of those people got very very rich, but it's a wasteland compared to what it was like.

Rather weird seeing Morley Safer of CBS attack Dukes of Hazzard (from CBS) as "trash" multiple times. It was an action show for kids, a live-action cartoon, and one of the most perfect such; better than A-Team (NBC's competition), where the premise immediately foiled itself because they couldn't use guns, the Dukes car and explosives stunts were better, and there was at least one hot woman on Dukes, usually a sausage festival on A-Team. Looking at Dukes as an adult now, the subtext of the Duke boys being proud Confederate traitors is super troubling, but they never did overt racism (there were very few black characters on any TV show, so Dukes being all honkies was typical; that's one place where A-Team did better), and good-hearted outlaws foiling the greedy, corrupt pigs was a great moral to teach kids. Beat up Boss Hogg, drink moonshine. Probably A-Team's ex-military criminal terrorist heroes wouldn't play well now, but that wasn't the objectionable part then.

And then CBS were working on Seven Brides for Seven Brothers, which was clearly gay Broadway, not Nashville, for the adult hillbilly audience, and failed utterly; I don't know how it got past mid-season replacement. NBC's somewhat edgier, adult political humor in Family Ties at least put something worth watching on the boob tube. Alex P. Keaton was interesting for Gen-X because he made usually-sensible arguments for conservative economics, against incoherent, mathematically-illiterate hippie bullshit from his Boomer parents, back when the GOP wasn't religious lunacy and moron brownshirts in MAGA hats; basically arguing for neoliberalism now. In a sitcom with no plot, meant to just be brainless entertainment, that was kind of impressive.

The special doesn't spend any real time in a writer's room, but that episodic shit where they bargain out what the content of a show will be, and then on-demand write something to fit, drove some really serious drug abuse, work loads, and just bad writing. The story of Danny Arnold, creator of Barney Miller, spending 18+ hours on set and sleeping there, and (not covered in the special) writing script pages as the show was being made, literally last minute, is just a rotten way to work. Barney was one of the few intelligent shows out there, if sometimes a little… racially caricatured… and often incoherent because the writers were in such a bad state.

(meta: I have no "television" category, and never will, because I treat all video entertainments the same now; but there was a time before Twin Peaks, B5, M1 when TV was massively below movies.)

Modern C 2.0

Fantastic book about C as actually used in modern code-bases. Interesting structure of levels 0-3, each of which covers a cross-section of topics at an understanding level. If you know everything in the summary already, you can just skip ahead to the parts you do want detail on.

Death Stranding is for Babies

hideo_kojima-very_easy

I would dispute "RPG fans", since even turn-based RPGs require mechanical skills, just not aim-and-shoot reflexes; and as someone who's spent 5+ years in Elder Scrolls Online where I clear group dungeons and world bosses solo, there's RPG players who don't need an easy or normal mode, let alone "very easy".

easy mode is for babies

As usual there's people who call this attitude "elitist". Well, sure. Dr Seuss, Dan Brown, and the Hardy Boys/Nancy Drew writers wrote in easy mode for babies. But most literature is above that level, you have to be able to read at a college level to read David Foster Wallace's Infinite Jest, you need some math & physics education to read Greg Egan's Diaspora, Schild's Ladder, Incandescence, or Dichronauts, you need a computing background to get more than superficial understanding of Tracy Kidder's The Soul of a New Machine or Rudy Rucker's The Hacker and the Ants. Those are elite entertainments. There's no way to dumb them down without totally ruining the experience.

In Kojima's case, his games are already compromised that way, endless tedious unskippable(!) cutscenes instead of getting to play the game, so I doubt it really matters. The Onion's new experimental videogame article nailed this, and Squenix was going down this road with their CGI movie adaptations, before they veered back into making actual games. Maybe Kojima will someday head back away from idiotic "narrative" and even more idiotic actors which the form is ill-suited to, and back into things with gameplay, strategy, and action, or maybe he'll just make movies and stop pretending this is playable.

Free Software Foundation Becomes Slightly Less Offensive

Which focuses on his sexual creepiness, and not his toe jam eating, horrific political views, conspiracy theories, and the lasting damage he's done to computer science with his aggressively anti-freedom "public license", and the promotion of emacs, which is most accurately classified as a mental disorder or an invasive fungus. If you want to edit text, use ed or vi or any nice editor, not a bad LISP interpreter with half an editor bolted on. And seriously, if you want to share your software, put it under actually-free BSD or MIT license and stop being a stallman.

Going back to 2001, there was his hostile takeover of glibc:

  • glibc 2.2.4: page down to "And now for some not so nice things."

And more recently a long-standing offensive joke in glibc being removed and then "restored" by the petty tyrant:

He demonized Miguel de Icaza of the Mono project (not my favorite software, but hardly objectionable):

Miguel de Icaza “is basically a traitor to the Free Software community” This was in response to my question about the new Microsoft “Open Source” labs. He went on to say that Miguel’s involvement in the project doesn’t give much confidence as he is a Microsoft apologist. The project looks to be concerned with permitting “Open Source” programs to work on the Windows platform and thus divert valuable developer time away from free platforms such as Gnu/Linux.
Mono framework is not so much of a problem, but C# shouldn’t be used in core apps as legal problems would be hard to work around. Recommends uninstalling any apps using C#.
— http://doctormo.wordpress.com/2009/09/19/software-freedom-day-in-boston/

So now he's finally reaped some personal consequences, after decades of this shit:

It's not unfortunate, it's 40 years overdue. The correct epithet is "the infamous Richard Stallman", just like "the infamous Unabomber Ted Kaczynski".