Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!csd4.milw.wisc.edu!uxc!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.misc Subject: Re: What is B&D? (Re: Bondage and Discipline Languages) Message-ID: <15458@mimsy.UUCP> Date: 13 Jan 89 13:47:01 GMT References: <8540@megaron.arizona.edu> <2630@ficc.uu.net> <13293@cup.portal.com> <5818@medusa.cs.purdue.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 55 >David Gudeman writes: >>You don't lable a language ``B&D'' just because you can't do something >>in that language, you call it that because (1) there is something you >>can't do, (2) the designers of the language predicted people would >>want to do it, and (3) the designers deliberately made it impossible >>because they thought it was a bad thing to do. In article <5818@medusa.cs.purdue.edu> rjh@cs.purdue.EDU (Bob Hathaway) writes: >This sounds like you don't know programming as well as compiler writers, >language designers, programming language hobbyists, ... I, and several >others I have talked to can do anything we can do in C in Pascal, Modula, >Ada, etc. The point is not whether the ultimate goal can be accomplished (the answer is almost always `it can'), but rather whether the means by which you wish to accomplish it has been ruled out in advance. My favourite example (as of the last time I gave an example, anyway :-) ) of this is the classical list-building loop: var head, tail, l : list; head <- nil; tail <- nil for ever do l <- get_input exit when l = nil (if head = nil then head else tail.next) <- l tail <- l rof return head This algorithm works fine in Pascal, C, etc. But the way I prefer to write it in C is this: struct list **p, *l, *head = NULL; p = &head; while ((l = get_input()) != NULL) { (*p)->next = l; p = &l->next; } return head; You *cannot* write this algorithm in (standard) Pascal, because it will not let you compute the address of `head' or that of `l->next'. There are reasons for that, but they amount to what David said: >>and (3) the designers deliberately made it impossible >>because they thought it was a bad thing to do. (and maybe it *is* a bad thing, but that is irrelevant to the label `B&D'). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris