Beyond Ada - The First Paranoid Programming Language ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ By Peter Fenelon ~~~~~~~~~~~~~~~~ With the major defence crises of the 1980's - Oliver North, Irangate, etc., it is becoming increasingly obvious that Ada simply lacks all the necessary facilities for generating truly paranoid programs. What was needed was a language which was not merely user-indifferent, but totally user-scared- in short, a Paranoid Programming Language. Who could meet the challenge? IBM? No, too neurotic already. DEC? No, VMS was already a paranoid operating system. It fell eventually to your 'umble author and his merry crowd of hackers to specify, define, implement, debug, y'know, the lot, the ULTIMATE programming language one cold evening on the way to Alcuin Bar. So, what features does PPL offer the user? DATA TYPES ~~~~~~~~ For the most part, PPL data types are comparable with those offered in conventional languages. However, a feature based closely upon the storage class specifier of C and the various ramblings of Ada has been introduced. Typical declarations would look something like those listed below: x : dodgy integer; y : unreliable string; z : inaccurate float; a : unlikely array[wrong..incorrect:probably integer] of probably_ebcdic char; p : pointer to random location; Compound types may also be declared as follows: slightly_iffy structure blob = x : hopelessly_broken list of too_small integer; y : improbable set of overflowing string; end blob; It has been said that this adds a certain degree of polymorphism to the language, but the person who said that was drunk at the time. ASSIGNMENT STATEMENTS ~~~~~~~~~~~~~~~~~~~ While PPL recognises the normal ':=' method of assignment, this is recognised as being slightly conventional. The normal alternatives to this rather pedantic style of programming are: x !:= 3 which assigns any other value but 3 to x x REALLY 3 which insists strongly that x is 3 x HONESTLY 3 which forces the system to believe that x is 3 x MAYBE 3 which just lets the system make its own mind up and, most powerful of all, x MIGHTBE 3 which doesn't really give a damn. 2: COMPOUND STATEMENTS ~~~~~~~~~~~~~~~~~~~~ BEGIN and END, or their terse C equivalents { and } were discarded as modelling a co-operative, nice environment in which things went as planned. This was no good to the brave designers of PPL. Instead we went for the more prosaic approach. Blocks of code are introduced with the GET_MOVING_YOU_x statement, where x ranges from "LAZY_GIT" through a range of increasingly obscene Albanian phrases, with increasing obscenity implying higher priority. The end of a block is marked with the PACK_IT_IN_x statement, where the same set of obscene phrases are used. The certainty with which statements are separated is purely dependent upon the number of semicolons... e.g GET_MOVING_YOU_SOD x MIGHTBE 44;; y !:= 100;;;;; z REALLY 200;;;;;;;; PACK_IT_IN_SOD is a typical example of initialisation. COMMENTS ~~~~~~ Comments begin with the errrrm.... statement with varying numbers of r's m's and full stops implying varying amounts of certainty, and end with an okay??? construct. This allows total paranoia to be exercised over the source... e.g. z MIGHTBE "hello" errm.... or perhaps not okay??? ;;; CONDITIONAL STATEMENTS ~~~~~~~~~~~~~~~~~~~~ Well, this is the field in which PPL really scores over all other programming languages. Whereas other programming languages only offer a generalised IF/THEN/ELSE or a CASE statement, PPL offers a whole class of utterly new wish-fulfilment statements. For example... IF x WAS_EVER 100 THEN DON'T print(x) IF j IS_NEARLY right DELETE all_incorrect_references_to j UNLESS a IS "My Name" THEN crash_unix WHENEVER errors THEN run_in_circles_scream_and_shout ON_SUSPICION_OF x < 100 CORRECT any_other_references_to x IN_CASE y NEARLY x THEN y REALLY x As it can be seen, the "_references_to" modifier is particularly useful for creating self-modifying code which is ludicrously easy to prove formally - quite simple, really, the code is all self-correcting. CONTROL FLOW ~~~~~~~~~~ In the matter of control flow it is hard to find anything in the same league as PPL. For the most part this can be taken care of by the conditional statements mentioned above; however, sometimes even these prove to be far too lax in their grip on reality and a set of more general-purpose commands are used, such as: REPEAT x !:= x + randomly varying y UNTIL x NEARLY right or WHILE some_bits STILL wrong DO fiddle(x);;;;; END or INSIST_UPON a IS 1;; UNLESS void OR illegal OR broken There is a CASE statement in PPL but since absolutely every possible outcome, even being eaten by wild dogs whilst whistling "Land of Hope And Glory", has to be taken into account it is rarely, if ever, used. PRAGMATIC BITS'N'PIECES ~~~~~~~~~~~~~~~~~~~~~ Naturally a language as rich as PPL offers a sophisticated range of reality-altering features. These are not defined by the normal PPL specification document ("Paranoid Programming Languages", P. Fenelon, Censored, Not available to the General Public) but are left to the implementors. Typical pragmas include the following: #distrust(procedure) to put extra suspicion on a procedure. #ignore(procedure) to totally forget about any calls to a procedure. #blame(procedure) pin the blame on this procedure when something dies. #hide(procedure) forget that procedure ever existed. Combined with a verison of the UN*X Make command this enables programs to accurately reflect the state of mind of the development team at any time. PROCEDURE CALLS ~~~~~~~~~~~~~ These aren't too difficult. However, as with the rest of PPL, the situation is complicated by the need to tangle with the language's paranoid view of life. They are implemented as follows: CALL procedurename;;;;;; errm... the most basic format of the call..... CALL procedurename WITH MISSING [parameters] errm... a nasty one this!..... CALL RANDOM LOCATION errm.... totally bollocks things up. CALL procedurename REPLACING parameters WITH others RUN_AROUND_LOOKING_FOR procedurename returns the address of a procedure Where external procedures are needed, a statement of the form FROM WHERE_THE_HELL_IS procedurename GRAB procedurename is used. The analogy with the Ada WITH/USE statement is quite phenomenal. Functions are declared similarly to procedures, and as they're too anal- retentive paranoid to ever return anything, always cause errors. Such is life. OPERATING SYSTEM INTERFACING ~~~~~~~~~~~~~~~~~~~~~~~~~~ At present, PPL is implemented on a CTS blueboard running under a strictly unlicenced port of Berkeley Unix 4.99999999 and therefore offers the full range of interprocess communications offered by this dubious operating system. These are implemented as standard procedures e.g. shout (processid,"Oi you!"); kill (processid,"violence level"); File access is slightly problematic. PPL expects all files to be in the /usr/spool/secret/keep.out/sod.off/$USER/private/locked/danger/secret directory, with permissions 0000. There can be no actual access to files in programs, as filehandling statements are equated to comments by the pre-processor. The exception to this is the shred statement which deletes all reference to a file, forgets the file ever existed, does not tell the president, does not pass go and does not collect $200. It has never met Oliver North, President Reagan, Monica Coghlan or Jeffrey Archer and does not own a copy of Spycatcher. MICROCOMPUTER IMPLEMENTATIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~ It is unlikely that full PPL will ever be implemented on a micro; the compiler (well, it's actually more of a groveller than a real compiler, but the PPL implementation commmmmiiiiitttttteee insist upon calling it that) is actually over 4.3 GBytes in size - bearing in mind the fact that PPL can look into absolutely EVERY ramification of EVERY decision, be it false, incorrect, scandalous, or just plain WRONG, in a program, it is felt that this is quite small. It is quite likely, however, that cut-down versions of PPL will become available - Paranoid Systems is already working on a smaller version runnable on hardware such as a Sun-3; it is called MDL (Manic Depressive Language) and consists of an Ada-compatible kernel with new paranoid keywords added in. An even smaller version could well become available for machines in the PC class; this is likely to go by the name of SDL (Slightly Dubious Language) and be based exclusively around the concept of protecting the user's decisions, filofax and BMW in an executive environment. Its programming facilities will probably be considerably limited although still pretty bloody paranoid. THE PARANOID COMPUTER ARCHITECURE CONCEPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I was privileged enough to visit the labs of Paranoid Systems, where work was in progress (so they told me- if you count a crowd of morose young men in black humming things by the Smiths work) on the first totally paranoid computer system. The PCS1 has been designed from the start to run PPL; the compiler has been ported from its original Z80 incarnation and is now in late Beta-test on the first prototype machine. What makes the PCS1 so powerful (or, indeed, paranoid) ? For a start, it's a long way from a traditional Von Neumann machine. In keeping with the requirements of the language, the computer system implements a sophisticated system of parallel processing - each processor tries to minimise the risk of any decision it has to take, checks it for consistency with the others before it's willing to do anything at all. And even then it does it slowly. Originally Paranoid Systems intended to use the Transputer as the processing element in the PCS1; however, after a considerable pause for thought, this audacious concept was rejected in favour of a strange mixture of Intersil 6100s, COSMAC 1802s and SC/MPs. These processors were chosen for their technical interest, lack of speed and total obsolescence. It was also felt that the Transputer might begin to get ideas above its station and spend too much time talking to other processors. And you know what that can lead to... Several of the machine's design concepts stand out as unique; interprocessor communication is, whilst being an integral part of the design concept, normally carried on secretly by a Main Bus Arbitration unit which, it is rumoured, was designed by a paranoid schizophrenic whose initials are something like GM, although this is in fact covered by the Official Secrets Act. The Main Bus Arbitration chip (or, to use Paranoid Systems parlance, Miserable Bugger, Aaargh) randomly steals bytes from the memory of one processor and distributes them freely to any other processor which is not too paranoid to listen. This actually forms quite a powerful means of communication. It is also rumoured that the nervous breakdown suffered by a Professor of Computation at Oxford and a computer science lecturer at York were due to a long and futile attempt to prove several theorems about this system in Communicating Sequential Processes notation. Few peripherals have yet to be interfaced to the PCS1 at present; when an attempt was made to attach a user terminal to it, in addition to the normal system console and rectal pattern-recogniser for security checks, the system merely wrote the message "ERROR 221: I/O PROCESSOR REFUSES TO COMMUNICATE WITH ANY OTHER DEVICES ON MAIN BUS. NOT MY PROBLEM." on the console. Since this attempt a team of AI experts, psychologists and psychopaths have been trying to interface a DecWriter to the beast in a vain attempt to get some output from it. All in all the PCS1 is an interesting product, and will, with some development, eventually work. Well, slightly better than it does now. Potential customers apparently include such paranoid institutions as the Cabinet Office, MI5, MI6, Special Branch and the University of York. CONCLUSIONS ~~~~~~~~~ Censored. IN NEXT MONTH'S ISSUE ~~~~~~~~~~~~~~~~~~~ How a PPL program wrote Spycatcher.