From carl@vlsi.cs.caltech.edu Thu Sep 17 23:15:28 1992 Subject: Things could be worse.... I thought you might be interested in this: InterPal a concurrent object oriented extension to InterCal. For those of you not in the "know", Intercal is an very silly, yet fully functional programming language, designed to have no features in common with any other programming language. New if we can just design "Compositional InterCal". From: xexeo@dxcern.cern.ch (Geraldo Xexeo) Subject: InterPal The InterPal Programming Language ================================= In this post we present a new language for concurrent programming based in objects. The language is an extension of Intercal. 1. Introduction. InterPal is a object-disoriented version of intercal. It is designed for bringing Intercal-like programming to the realm of MIMD machines. Specially, there will a version for the CM-5 real soon now. InterPal add few news commands to Intercal. The goal of this commands is to control concurrence and message passing. 2. Objects Each InterPal object is described as a InterPal program. They are called netters. Netters can be in one of 4 states: active, waiting for mail, sleeping and dead (or ghost). Active netters are running and can be doing calculations, i/o or sending messages. A message is called a mail. The mechanism for sending mails is described later in this post. A netter that is waiting for mail check its mailbox every tick. A tick is a unit of time designed by the user. A netter that is sleeping waits for being awaked. There are two methods of making a sleeping object active: the system have a alarm clock that "sound" at a requested time and another netter can wake them. A dead netter just hangs around in the system. If active netter find a dead netter in the same processor, the active netter is scared and faints, becoming a slepping process. If an active netter finds more than 10 dead netters in the same processor, it is scared to death and becomes a dead netter. If more than 100 dead netters are in the same processor this processor is denominated a cemetery. Active netters are not allowed to enter in a cemetery unless their religious bit is set. There is a special object called GOD. The GOD process goes around the processors (at random) and turn dead netters in active netters (in batches of at least 100 and at most 4623). Each netter is identified by an unique number. 3. Interfaces There are no explicity interface in InterPal objects. When a netter receives a mail, this mail has an message number.This is the number of the line the netter should do a GOTO before start executing. 4.The new commands: a)SENDMAIL(object,messagenumber,parameter). Send a mail to netter object to GOTO line number message number and one parameter. b)WAIT MAIL Waits for mail with the smallest possible tick in the system c)WAIT MAIL tick Waits for mail is a specified tick d) SLEEP Sleeps e)SLEEP AND WAKE UP AT X Sleep and set up alarm clock for X ticks in the future f) WAKE UP X Wake up netter number X g) SUICIDE Becomes a ghost process h) KILL n Kill process n, that becomes a ghost. i) BECOME RELIGIOUS Processes that are religious have special characteristics: 1)They don't SUICIDE. They just don't care about this command. 2)If killed, they don't become a ghost, but disappear from the system 3)If they find the special process GOD, they become saints. Saints are allowed to use the private instruction REINCARNATE. j) REINCARNATE X Turn a dead process X in an active process X. k) NAME Y Gives the name of a process l)READ MAIL Y Read the parameter of the last received mail and put in variable Y 5. The mail distribution process. When a netter X send a mail, this mail goes to the post-office. Every processor has two special processes: a postoffice and a postman. The sequence of message delivering is the following. a) The postoffice receives mail and put in a mail-bag. b) at every tick, it ramdomly select P mails from the mail-bags and distribute to the postman. c) The postman read the object name and find wich netters belong to this processor. Then, the postman distribute the mail to the local processor netters. The remaining mails are sent back to the post office. d) The postoffice exchange its mail-bag to a ramdonly selected post office in the system. 6. Example Here is a valid Interpal Program that prints the second number read if the first number read is 243: in netter 1 NAME 1 2 PLEASE DO WRITE IN .2 DO WRITE IN .3 3 GIVE UP COME FROM 2 PLEASE SEND MAIL (.2,10,.3) SUICIDE in netter 243 NAME 243 WAIT MAIL GIVEUP 10 READ MAIL .4 PLEASE ABSTAIN FROM SUICIDE DO READ OUT .4 20 REINSTATE SUICIDE SLEEP 7. Conclusion The language is powerful enough to allow concurrent programming and gives enough rope to the user. The mail system is designed to simulate real-life mailing and appears to be very good to support simulations of enterprises. Its non-determinism guarantees the possibilities of various different sequences of actions. The states of the objects open a totally new perspective of research in the areas of deadlock detection, programmers mental sanity and religious issues.