Blog

Tower of Babble

Programmers almost compulsively make new languages; within just a few years of there being computers, multiple competing languages appeared:

It proliferated from there into millions; probably half of all programmers with 10+ years of experience have written one or more.

I've written several, as scripting systems or toys. I really liked my Minimal script in Hephaestus 1.0, which was like BASIC+LISP, but implemented as it was in Java the performance was shitty and I had better options to replace it. My XML game schemas in GameScroll and Aiee! were half programmer humor, but very usable if you had a good XML editor. Multiple apps have shipped with my tiny lisp interpreter Aspic, despite the fruit company's ban on such things at the time. A Brainfuck/FORTH-like Stream, working-but-incomplete tbasic, and a couple PILOT variants (I think PILOT is hilariously on the border of "almost useful").

Almost every new language is invented as marketing bullshit based on a few Ur-languages:

  • C++: Swift
  • Java: Javascript (sorta), C#, Go
  • Awk: Perl, Python, PHP, Julia
  • C: Rust
  • Smalltalk: Objective-C
  • Prolog: Erlang, Elixir
  • ALGOL: C, Pascal, PL/1, Simula, Smalltalk, Java
  • LISP: Scheme, ML, Haskell, Clojure, Racket
  • BASIC: None, other than more dialects of BASIC.
  • FORTRAN: None in decades, but is the direct ancestor of ALGOL & BASIC.
  • COBOL: None in decades.

A few of these improve on their ancestors in some useful way, often performance is better, but most do nothing new; it's plausible that ALGOL 68 is a better language than any of its descendants, it just has mediocre compiler support these days.

Certainly I've made it clear I think Swift is a major regression, less capable, stable, fast, or even readable than C++, a feat I would've called impossible except as a practical joke a decade ago. When Marzipan comes out, I'll be able to rebuild all my 15 years of Objective-C code and it'll work on 2 platforms. The Swift 1.0 app I wrote and painfully ported to 2.0 is dead as a doornail, and current Swift apps will be uncompilable in 1-2 years; and be lost when Apple abandons Swift.

When I want to move my Scheme code to a new version or any other Scheme, it's pretty simple, I made only a handful of changes other than library importing from MIT Scheme to Chez to Chicken 4 to Chicken 5. When I tested it in Racket (which I won't be using) I had to make a handful of aliases. Probably even CLISP (which is the Swift of LISPs, except it fossilized in 1994) would be 20 or 30 aliases; their broken do iterator would be hard but the rest is just naming.

Javascript is a pernicious Herpes-virus-like infection of browsers and desktops, and nothing can ever kill it, so where it fits the problem, there's no reason not to use it. But there's a lot it doesn't do well.

I was leery of using FreePascal because it has a single implementation (technically Delphi still exists, but it's $X,000 per seat on Windows) and minimal libraries, and in fact when it broke on OS X Mojave, I was disappointed but I-told-you-so.

I'm not saying we should quit making new Brainfuck and LOLCODE things, I don't think it's possible for programmers to stop without radical brain surgery. But when you're evaluating a language for a real-world problem, try moving backwards until you find the oldest and most stable thing that works and will continue to work, not piling more crap into a rickety new framework.

The Biblical reference in the title amuses me, because we know now that it requires no malevolent genocidal war deity scared of us invading Heaven to magically confuse our languages and make us work at cross purposes; anyone who can write and think splinters their thought into a unique language and then argues about it.

Eldritch World

I wrote a text adventure:

It's like 15% complete, you can reach the first of four "recursions"/other worlds but then you're stuck. And today it only has a Mac console binary (you can run it from source on other platforms, with a little effort), I'll get on the cross-platform compiling and Terminal wrappers tomorrow, but this is a playable thing under a deadline!

TODO App

I'm yet again frustrated by the state of checklist TODO apps. I had a perfect one once, ToDo on the Palm Pilot; aesthetically it was of its time, but for usability on a stylus-based PDA it was perfect. Everything since then has been a compromise.

Must:

  1. Run locally on iPhone and Mac.
  2. Sync automagically, preferably with iCloud and/or Dropbox.
  3. Have multiple lists, though does not need nested folders.
  4. Show a list of items I can check on/off.
  5. Be able to show or hide checked items, delete checked items with a command.
  6. Be able to reorder by hand (or sort with a command).
  7. Start up instantly right back where I was.
  8. Be usable while drunk, stoned, tired, or hungry. UI cannot be a giant pile of fiddly little switches.

Nice to Have:

  1. Due dates/expire dates.
  2. Priority tags.
  3. Search screen to show "What's next?", showing date, priority, list, item in that order.
  4. Notifications. But local notifications require a recent app launch, so you might miss stuff; or interacts with calendar which many people find annoying; or uses push notifications, which costs real money past a small number of users.
  5. Emoji & color tags, photos, long notes, etc.

Must Not:

  1. Give my information to Google, Microsoft, Facebook, or other evil mega-corporation who will weaponize my shopping for killer drones or advertising, or both. I'm dubious of Apple & Amazon, but at worst they seem to be venal, not evil.
  2. Be subscription-based.

Don't Care:

  1. Other platforms. Android, Linux, Windows, I don't use these so they're not a pain point for me. If mulle-objc works out, I could think about that.
  2. Pomodoro, GTD, and other fetishistic rituals.

State of the Field

  • Clear was good on iOS, but it's been "dead"/rebooting at Impending for 2 years already, and they won't be making a new Mac version.
  • Apple's Reminders is awful on the Mac (try finding the "show all" button, and keeping your list in order).
  • Things, Trello, OmniFocus, etc. are too slow & heavy for a grocery list.
  • Text files in Editorial or Drafts don't have usable (finger-sized) checkboxes.
  • Wunderlist got bought by Microsoft and destroyed as per usual. They're getting to be as bad a product graveyard as Yahoo! was.
  • RememberTheMilk is not super useful until you pay $40/year, which is not what a dumb todo list should cost.

What Am I Doing?

Thinking about this. I could write the app I want, release it for $5 on each platform, use Marzipan to make it use the same codebase. In theory, this is pretty easy; I can write a database-backed table view thing in a week. Making it nice is a while longer. Marketing is my least favorite thing, who do I use to get it in front of millions of people?

But I'd have to pay Apple to get back into the sharecropping business, and deal with their shitty Xcode tools and the rotting corpse of developer.apple.com which got fucked over by Apple marketing so you can't get to the FUCKING DOCUMENTATION. @invalidname went to work for them and got sucked into the black hole.

Time and Space Wednesday Music

Feeling like some prog, spacey rock, á la Venture Bros.

Apple Music was no help today:

apple music blank albums

I'm really not "into" Michael Jackson, especially not twice. I assume it took him appearing on GotG Awesome Mix as support. So I just went thru and hit Dislike on every one of the little creep's albums, hopefully this never happens again. I keep suggesting to Apple Music to let us block an artist we don't like so they never reappear, and they've done no such thing. Somewhat ironic: His last few albums were Invincible and Immortal; not so much.

How Fast is My Scheme

I ran a dumb Sieve of Eratosthenes benchmark on a few Schemes. I have previously found idiomatic Swift 3,151x slower than C so surely a GC'd LISP can't do that great, right?

Chicken (compiled) and Chez do great; I would expect Chez to do better on a less numeric example, this kind of array-humping is what Chicken's perfect for, since it just compiles to C. Chicken's interpreter is ridiculous, in dev it's fine for seeing if something works, but you'd never ship that. Racket's sad, and it gets worse if you try to do anything productive. Biwascheme was impossible to even test properly, but at 10% completion it wasn't going to do anything useful.

Also, I want to complain about every Scheme having a different way to call the interpreter as a script, and invoke main with command line arguments. NOT A ONE of these are consistent, and only Chicken does what's reasonable.

# C - 100% C
mdh@Aegura:~/Code/CodeC% time ./primes 1000000 >~/tmp/primes-c.txt
./primes 1000000 > ~/tmp/primes-c.txt  0.05s user 0.00s system 92% cpu 0.054 total

# Chicken interpreter - 1.4% C
mdh@Aegura:~/Code/CodeScheme% time src/primes.scm 1000000 >~/tmp/primes-chicken.txt
src/primes.scm 1000000 > ~/tmp/primes-chicken.txt  3.74s user 0.12s system 99% cpu 3.872 total

# Chicken compiled - 26.2% C
mdh@Aegura:~/Code/CodeScheme% ./build.zsh primes
Compiling primes.scm
Linking...
./build.zsh:40: no matches found: *.import.scm
Built bin/primes
mdh@Aegura:~/Code/CodeScheme% time bin/primes 1000000 >~/tmp/primes-chicken.txt
bin/primes 1000000 > ~/tmp/primes-chicken.txt  0.19s user 0.01s system 98% cpu 0.206 total

# Chez interpreted - 23.8% C
mdh@Aegura:~/Code/CodeSchemeOld/chez% time ./primes.ss 1000000 >~/tmp/primes-chez.txt
./primes.ss 1000000 > ~/tmp/primes-chez.txt  0.20s user 0.03s system 98% cpu 0.227 total

# Chez compiled - 23.9% C
mdh@Aegura:~/Code/CodeSchemeOld/chez% chez-compile.zsh primes
compiling primes.ss with output to primes.so
()
()
mdh@Aegura:~/Code/CodeSchemeOld/chez% time bin/primes 1000000 >~/tmp/primes-chez.txt
bin/primes 1000000 > ~/tmp/primes-chez.txt  0.20s user 0.02s system 97% cpu 0.226 total

# Racket interpreter - 9.6% C
mdh@Aegura:~/Code/CodeRacket% time ./primes.rkt 1000000 >~/tmp/primes-racket.txt
./primes.rkt 1000000 > ~/tmp/primes-racket.txt  0.46s user 0.09s system 99% cpu 0.560 total

# Racket compiled - 12% C
mdh@Aegura:~/Code/CodeRacket% raco exe primes.rkt
mdh@Aegura:~/Code/CodeRacket% time ./primes 1000000 >~/tmp/primes-racket.txt
./primes 1000000 > ~/tmp/primes-racket.txt  0.37s user 0.07s system 99% cpu 0.443 total

# Biwascheme - 0.03% C
# Used stopwatch, took 13.89s for 100,000, couldn't get a result for 1,000,000

Scheme Record to RecordType

So, in "classic" Scheme (up to R5RS), there were no structs/records/classes. You could fake them with a Vector and writing all the accessor methods by hand, but it sucked.

SRFI-9 added a very minimalist record type with a lot of repetition, and no inheritance, though at least SRFI-17 fixed setters.

R6RS (as implemented in Chez Scheme) added a much more powerful system with inheritance and constructor methods, but half the Scheme community hates nice things and voted it down. There's a half-assed reimplementation of R6RS in SRFI-99 and sequels, but it still doesn't have read/write mechanisms. R7RS still only ships with SRFI-9 built in. Unbelievable mess.

Chicken has a convenient define-record macro, and read/write methods, but by default uses SRFI-9, and hides SRFI-99 in an egg; so chicken-install -s srfi-99 and then (import srfi-99) everywhere, and then write a ton of boilerplate for every type. So I just automated it with Python (doing string parsing in Scheme is more annoying):

Documentation is in the module help (or just read the source, Luke). I use it by writing the Chicken macro (define-record Point x y), then at shell:

% pbpaste|schemeRecordToRecordType.py|pbcopy

And paste back:

;; (define-record Point x y)
(define-record-type Point #t #t
    (x)
    (y)
)
(define-reader-ctor 'Point make-Point)
(define-record-printer (Point p out)
    (format out "#,(Point ~S ~S)"
        (Point-x p) (Point-y p) 
))
; module exports:
; make-Point Point? Point-x Point-y

Note that none of this really gets me an "object-oriented" system, but records are sufficient for most programs, and inheritance works with define-record-type. There are OOP systems but I don't especially like any of them so I'm passing on them for now.

The Infocom Implementor's Creed

THE IMPLEMENTOR’S CREED

I create fictional worlds. I create experiences.

I am exploring a new medium for telling stories.

My readers should become immersed in the story and forget where they are. They should forget about the keyboard and the screen, forget everything but the experience. My goal is to make the computer invisible.

I want as many people as possible to share these experiences. I want a broad range of fictional worlds, and a broad range of “reading levels.” I can categorize our past works and discover where the range needs filling in. I should also seek to expand the categories to reach every popular taste.

In each of my works, I share a vision with the reader. Only I know exactly what the vision is, so only I can make the final decisions about content and style. But I must seriously consider comments and suggestions from any source, in the hope that they will make the sharing better.

I know what an artist means by saying, “I hope I can finish this work before I ruin it.” Each work-in-progress reaches a point of diminishing returns, where any change is as likely to make it worse as to make it better. My goal is to nurture each work to that point. And to make my best estimate of when it will reach that point.

I can’t create quality work by myself. I rely on other implementors to help me both with technical wizardry and with overcoming the limitations of the medium. I rely on testers to tell me both how to communicate my vision better and where the rough edges of the work need polishing. I rely on marketeers and salespeople to help me share my vision with more readers. I rely on others to handle administrative details so I can concentrate on the vision.

None of my goals is easy. But all are worth hard work. Let no one doubt my dedication to my art.

—Stu Galley, Infocom

From a Moonmist retrospective.

Also, I loved his Seastalker — I was marginally older than the target audience, and sailed thru it fast, but it combined so many things I like, Tom Swift, Hardy Boys, underwater laboratories (SeaLab 2020 pre-Adult Swim, Man from Atlantis, Voyage to the Bottom of the Sea TV show, etc.), and tactical roguelike combat with the submarine. For years the sticker was permanently attached to my dresser mirror.