Path: news.cs.au.dk!not-for-mail From: "Sascha Kimmel \(tricos Mediaservice\)" Newsgroups: comp.lang.beta Subject: RE: How to read Beta code Date: 10 Jan 2000 18:02:15 -0000 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 219 Approved: mailtonews@cs.au.dk Distribution: world Message-ID: <20000110180215.1924.qmail@noatun.mjolner.dk> Reply-To: "Sascha Kimmel \(tricos Mediaservice\)" NNTP-Posting-Host: daimi.cs.au.dk X-Trace: xinwen.cs.au.dk 947527355 10571010 255.255.255.255 (10 Jan 2000 18:02:35 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 10 Jan 2000 18:02:35 GMT Xref: news.cs.au.dk comp.lang.beta:12211 Hi, the BETA book is currently available at the amazon.com auction: http://s1.amazon.com/exec/varzea/ts/exchange-glance/Y03X3141356X6437647/qid= 947524232/sr=1-1/ref=a_ob_qs/103-4839772-4997420 Object-Oriented Programming in the BETA Programming language Item Description Minimum Bid: $19.00 (plus s&h fee: $4.99) Closes In: 2 days, 06:06:09 Seller: thebookcenter: (279) See thebookcenter's other auctions Location: Oakdale, CA, United States Number of Bids: 0 (starting bid: $19.00) Quantity: 1 High Bidder: No bids. Accepted Payment Methods: Amazon.com Payments (Visa/MC/AmEx/Disc). Personal Check. Cashier's Check / Money Order. Shipping Terms: Buyer pays. Will ship internationally. As you can see, it's the one and only book that is avaiable! Regards, Sascha Kimmel > -----Original Message----- > From: Garry [mailto:memphis@macconnect.com] > Sent: Friday, December 31, 1999 10:10 PM > To: usergroup@mjolner.dk > Subject: How to read Beta code > > > This is just some thoughts from a newbie on how to read Beta code --- > I'll write this down while I'm still a newbie and can see that some of > the concepts are indeed quite subtle. One thing I do when learning a > new programming language is to decide on a pronunciation grammer so that > I can unamiguously read the program code aloud. The goal is to vocalize > the code in such a way that it can be read to a person over the > telephone in natural language yet such that they will understand it > perfectly and be able to write down the identical code. > > (* This is an approach I learned from using the Forth programming > language for many years. It became the general practice in Forth to put > code to the "read aloud" test and to develop natural language > pronunciations in place of "spelling out the esoteric symbols". Forth is > relatively easy to read aloud because the constructs have been parsed by > the programmer into simple RPN. Spelling out the symbols is > "communication" only in the same sense as the gibberish of an American > tourist spelling out words from his phrase book letter-by-letter. *) > > Here's what I've learned so far about reading Beta code: > > Generally > : can be prounced "is" or "which is" > @ "an" > ^ "a reference to a" > & "actually" > , "and" > (# "where" > #) "and that's that" > x[] "the x box" > -> "enters into" or "entered into" > x.p "x's p" > ; "ok?" > : (# "is generally" > y (# "a specialization of y where" > > Examples: > > point: (# x,y: @integer #) > "point is where x and y is an integer, > and that's 'point' " > > p: @point; > "p is a point, ok?" > > topleft: ^point > botright: ^point > "topleft is a reference to a point" > "botright is a reference to a point" > > topleft[] -> botright[] > "topleft box enters into botright box" > > (* Note: it is important to say "enters into" rather than "to" or > "becomes" or "assigned to" because those other verbalizations are > misleading. "->" is a very powerful operation. "->" is NOT (simple) > assignment. It is, technically, an operation that sets the state of the > entity on the right to the state produced on the left. At least that's > what I think... ;-) *) > > Defining objects: > x: (# ... #) > "x is generally ... and that's 'x' " > x: y (# ... #) > "x is a specialization of y where ... and that's 'x' " > x: &y > "x is actually a y" > Defining a singular object: > x: & (# ... #) > "x is actually where ... and that's 'x' " > x: & y (# ... #) > "x is actually a specialization of y where ... and that's 'x' " > Virtual patterns: > x:< > "x is basically" > x::< > "x is also basically" > x:: > "x is finally" > Defining functions: > enter y > say "enter 'y' " or "it is entered with y" > exit z > say "exit 'z' " or "it is exited with z" > do > say "does" or "it does" > > > (* Note: I find the words "class and subclass" and "superior/super and > inferior/subordinate" and "inner and outer" to be confusing because they > are more spatial concepts (to me) than logical concepts. Rather than > constantly translating code into tree diagrams or nested block diagrams > in my head with constant decisions whether to mentally draw the tree > with the root node at the top or bottom I avoid those words altogether > and think, and _pronounce_, in terms of "basic" and "specialized" > things. For this reason when I see the Beta word ":<" I say "is > basically" and when I see "inner" I actually say "the specialization". > Try it --- it may help clarify things for you. *) > > Example: > employee: > (# name: @text; > birthday: @date; > dept: ^Department; > totalHours: @integer; > registerWork: > (# noOfHours: @integer > enter noOfHours > do noOfHours + totalHours -> totalHours > #); > computeSalary:< > (# salary: @integer > do inner > exit salary > #); > #); > worker: employee > (# seniority: @integer; > computeSalary::< > (# do noOfHours*80+seniority*4 -> salary; 0 -> totalHours #) > #); > which is read as > "employee is generally > name, which is a text, ok? > birthday, which is a date, ok? > dept, which is a reference to a Department, ok? > totalHours, which is an integer, ok? > registerWork, which is where > noOfHours is an integer > entered with noOfHours > it does noOfHours plus totalHours entered into totalHours > and that's 'registerWork' > computeSalary which is basically > salary, which is an integer > it does the specialization > it exits with salary > and that's computeSalary > and that's 'employee' " > "worker is an employee where > seniority is an integer, ok? > computeSalary is also basically > where it does noOfHours times 80 plus seniority times 4 > entered into salary, ok?, zero entered into totalHours > and that's 'worker' " > > > Credit: the example code is taken from Madsen's excellent BETA Language > Introduction, reprinted in edited form as Mjolner Informatics Report MIA > 94-26(1.2) available at > > > > It seems to me that the designers of BETA were diabolically clever in > inventing a language that maps one-to-one onto high-level semantic > concepts and is VERY readable. > > It is possibly important to take especial note of those constructs that > can not be read simply left-to-right or that can not be read properly > without considering more of the context. For example, > x -> y > can be read as "x enters into y" quite adequately if x and y are simple > types such as integers, but if they are objects it would be better to > read "the state of x enters into the state of y". > x: (# ... #) > is generally read as "x is generally..." but if the pattern contains no > "inner" or ":<" then saying "generally" may be misleading, so look ahead > and say "generally" only if there is an "inner" or virtual pattern > coming up and otherwise say "where". > > > p.s. I still haven't located a copy of the book "Object-Oriented > Programming in the Beta Programming Language" by Ole Lehrmann Madsen, et > al; if anyone can sell a copy to me please let me know. I will pay > dearly; I have more than $20 in the bank this week! Happy new year! > > -- > Garry Roseman > Independent Macintosh Software Developer > Memphis, TN > >