Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ukma.UUCP Path: utzoo!watmath!clyde!cbosgd!hasmed!qusavx!ukma!david From: david@ukma.UUCP (David Herron, NPR Lover) Newsgroups: net.lang Subject: Re: Alternative Structures Message-ID: <413@ukma.UUCP> Date: Fri, 21-Dec-84 00:55:58 EST Article-I.D.: ukma.413 Posted: Fri Dec 21 00:55:58 1984 Date-Received: Sun, 23-Dec-84 00:49:58 EST Organization: Univ. of KY Mathematical Sciences Lines: 114 [ Line eater, Line eater, eat me a line ] [Previous line was a sacrifice to the line eater bug.] [ somebody please tell me if the previous two lines didn't make it through.] [thank you]. >Bill Smith >(ihnp4|pur-ee)!uiucdcs!wsmith >From: wsmith@uiucdcsb.UUCP >Subject: Alternative Structures >Message-ID: <8900018@uiucdcsb.UUCP> >Date: Sat, 15-Dec-84 23:05:00 EST >Ordinary languages like C, Pascal, etc... either make no restrictions >on case of letters in identifiers, make both cases be the same, or they >require you to use only one case. >Is there any reason that case can not be used to contain semantic >information? Probably not. Case is useful for making things stand out. That is semantic information. For a human though, not a computer. Computer doesn't care what case things are in, everythings a number to it. >For example, all identifiers would have to begin with an upper case letter >and the rest of the identifier would be lower case. The language could then >define lowercase prefixes that determine different types so you would use pFoo >for a pointer to a structure named Foo. (typedef struct Foo *pFoo;) All which identifiers. User identifiers or compiler identifiers? The idea of using prefixes here isn't too bad. C already does that. To declare a pointer, you prefix the identifier with "*". To get it's value you prefix it with "*". You have to be able to say that your prefix is better than the prefix already in use. >If Foo had a field of type pFoo that was named Down, (pFoo Down;) >then with these conventions to reference the fourth element from beginning >the varable List (struct Foo *List) and assign the second element to point to >it, this would suffice > pListDown = pListDownDownDown; >or equivalently in C > List->Down = List->Down->Down->Down; >The p prefix is needed to indicate that the pointers are to be assigned and >not the structures themselves. Your notation is getting rather confused here. First, what would tell the compiler that the identifier "ListDown" is different from the structure reference "ListDown"? Or are you restricting us from using uppercase letters in the middle of an identifier? I can see how you are saying that "pListDown" is equivalent to "List->Down". "p" is equivalent to "*", and saying "ListDown" is equivalent to "List.Down". So it converts to "(*List).Down" in C. What I don't see is "pListDownDown" being equal to "List->Down->Down". The conversion makes it "(*List).Down.Down". But, it should convert to "(*(*List).Down).Down" for what you want. And this doesn't have the 'p' --------- applied to it? | | How come this Down has ------ | the 'p' applied to it? | | | | >An alternative notation is v v > pList.Down = pList.Down.Down.Down; >with . also being used as the separator for normal field references. >I am interested in peoples reactions to either of these conventions as opposed >to C's I don't see how this is an improvement over C. C already has an operator which gives you the contents of a pointed to object ("*"). C also has other operators which are useful. What other kind of things are you wanting these prefixes to do? Why can't these things be handled using unary operators? Also the idea of using caps to start all identifiers seems equivalent to the idea in Pascal of capitalizing (or underlining) all keywords. You soon get lost in a sea of capitalized words. When I use a capitalized identifier, it is because I want it to stand out. The Pascal people are saying "Capitalize all identifiers so they stand out". With Pascal this is rather necessary since Pascal programs are so wordy. With C this isn't necessary since the control structures serve to seperate identifiers from keywords already. Ok. So what happens if we say that a capital letter starts all identifiers. We lose the ability to make certain identifiers stand out. That can be an important thing in making a program readable. While we are on the subject of how tokens get seperated visually..... With these prefixes on tokens, the prefix gets lost visually as well. The prefix is this symbol called a letter, our internal English parser knows that letters are the component parts of symbols called words. (My first grade teacher taught me this when I was 6, not using the same words, but with the same meaning). While reading the program, my mind (which is used to reading english text) parses "pList" as a word, albeit with a funny idea of where the capital letters go, but a word just the same. I have to do some mental work to know that pList is actually saying "the contents of List". This mental work slows down my parsing of the expression that pList is a part of, and eventually of the program as a whole. Maybe there is just something here I am not seeing. --:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--:- David Herron; ARPA-> "ukma!david"@ANL-MCS (Try the arpa address w/ and w/o the quotes, I have had much trouble with both.) UUCP -:--:--:--:--:--:--:--:--:- (follow one of these routes) {ucbvax,unmvax,boulder,research} ! {anlams,anl-mcs} -----\ vvvvvvvvvvv >-!ukma!david {cbosgd!hasmed,mcvax!qtlon,vax135,mddc} ! qusavx -----/ ^^^^^^^^^^^