Weird Programming Languages
July 5, 2001 4:14 AM   Subscribe

Weird Programming Languages All the info you wanted to know about obscure programming languages
posted by stevridie (12 comments total)
 
What, no var'aq?
posted by harmful at 6:06 AM on July 5, 2001


What, no ColorForth?
posted by holgate at 7:41 AM on July 5, 2001 [1 favorite]


It's worse than that. FORTH is high up on the write-only code scale in that previously written code quickly becomes very hard to read in short order. A lot of this has to do with the fact the FORTH doesn't really have syntax and some of the control operators are postfix and others are not (if then is a perfect example of a non-postfix operator). I've found assembly language more readable than FORTH.

colorForth is especially bad if you're red/green color-blind, although your editor could take care of that.

What colorForth does is eliminate state from the interpreter. In forth, a typical definition looks like this:
: sumsq + dup * ;
Now understand that ':' is an operator which reads the next word of input and creates a new entry in the current dictionary from that word, then it flips a bit which tells the interpreter that we're in "compiling mode". Operators may execute differently if the interpreter is in compiling mode. For example, in compiling mode ';' compiles an end word and turns off compiling mode. In execute mode, ';' doesn't do anything (useful).

colorForth removes the state from the interpreter and associates it with the code itself. This means that you can interleave immediately executable code with deferred execution code and only the color distinguishes between the two.

I know all this stuff from writing a FORTH compiler (subroutine-threaded FORTH). It was an interesting experience, but I didn't attain the zealotry needed to actually write anything in the language.

At the last place I worked I wrote a language that had only two data types: strings and booleans and the only control structures were if/else. The language was designed to model decision trees and while not Turing complete, I *could* guarantee that all code would execute to completion (which is important from a security standpoint, which we cared about a lot). The language read like C, compiled to a virtual machine in the wink of an eye and linked at run-time. The entire VM, including graphical debugger took up 44K, and most of that was the debugger.
posted by plinth at 10:12 AM on July 5, 2001


forth is just as unreadable as postscript, imo. ps is based a on stack, with the last command going on top, so it's most often interpreted right to left. still, forth is not listed 'cos was a serious language. in fact, i remember reading once that one or several microprocessors were designed not with assembler as its native machine language, but rather forth.
posted by moz at 11:16 AM on July 5, 2001


I never considered Forth write-only, though to be honest I've never had to maintain somebody else's code. Maybe I just "got" the postfix Forthness from the beginning. Forth, Inc. is still out there making compilers and programming environments, mainly for embedded systems, so far as I can tell.

I thought PostScript was originally based on Forth, anyway.

Dang, I need to play with that again. Brodie's Starting Forth is possibly still the most fun I've ever had with a computer book. (Well, one must enjoy puns. But then, hackers usually do.)
posted by dhartung at 11:47 AM on July 5, 2001


I paid for three different Forth interpreters on the Apple II. For a while I was obsessed with that language.
posted by kindall at 12:08 PM on July 5, 2001


PostScript is indeed similar to FORTH, but differs in a number of key ways. It's a lot closer to being PostFix than FORTH and is thus a much more consistent syntax. Built-in data types are actually typed (ie, a function can check to make sure it has the right number and type of arguments). And the VM is defined in such a way that you can easily make closures (not as easily as LISP variants). Closures are possible in FORTH, but the syntactic sugar to make that work is pretty heinous. PostScript also has way better mechanisms for dealing with run-time errors.

I used to write code for PostScript printers (and by that, I mean the C and PostScript needed to make a printer into a PS printer), and it had a much better feel to it than FORTH ever did as a language. One printer I worked on had the entire front panel menu code written entirely in PS, including making it self-localizing. I'd shudder to think about writing that in FORTH, whereas in PS, you just swap dictionaries with the localized strings bound to the same symbolic tags.
posted by plinth at 12:11 PM on July 5, 2001


one example of postscript in action, for anyone interested, is jwz's hack to print out fancy looking labels for cassette tapes. he's also got a version to do the same for video tapes as well.

oddly enough, jwz's code is not HTML compliant. but i guess that's the way html ought to be, right!
posted by moz at 1:25 PM on July 5, 2001


The strangest programming "language" I've ever used professionally is called LabVIEW. It's a parallel-execution dataflow language, and a "program" in LabVIEW looks like a schematic. If you want to add two numbers, you use a graphics editor to put up two variable reference blocks, and then pipe their outputs into an adder. Its output then can be routed to where-ever it is needed.

It sounds cumbersome, and for some kinds of things it is. But though there's a considerable learning curve associated with it, it's actually an extremely clean approach to solving certain kinds of problems. Using it, I was able to solve the problem I was working on in less than a month, and I had it working in prototype in two weeks. Writing that same code in C would probably have taken a year.
posted by Steven Den Beste at 3:56 PM on July 5, 2001


if you want to see something *truly* scary, click on brian raiter's link (at the top) and look at his Intercal floating point library and implemenation of fourier transforms in Intercal. yikes!!
posted by muppetboy at 4:48 PM on July 5, 2001


[self_link_alert]
It took far too much effort for far too little payoff, but I managed to create this and this a while back - two of the very very few non-trivial Malbolge programs I've ever run across. (Geek, thy name is youhas.)
[/self_link_alert]
posted by youhas at 6:19 PM on July 5, 2001


Forth has shipped with every PCI-based Macintosh in the form of Open Firmware.

Type Command-Option-O-F to access your Forth interpreter. Sun boxes apparently use Open Firmware as well.

www.openfirmware.org
posted by dweingart at 9:24 PM on July 5, 2001


« Older   |   Those French have been at it for a very long time. Newer »


This thread has been archived and is closed to new comments