Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: notesfiles Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!hao!hplabs!hp-pcd!hpcnoe!dat From: dat@hpcnoe.UUCP (dat) Newsgroups: net.lang Subject: Re: Orphaned Response Message-ID: <4500005@hpcnoe.UUCP> Date: Tue, 1-Jan-85 04:00:00 EST Article-I.D.: hpcnoe.4500005 Posted: Tue Jan 1 04:00:00 1985 Date-Received: Mon, 14-Jan-85 03:18:20 EST References: <8900018@uiucdcsb.UUCP> Organization: Hewlett-Packard - Fort Collins, CO Lines: 84 Nf-ID: #R:uiucdcsb:8900018:hpcnoe:4500005:37777777600:2777 Nf-From: hpcnoe!dat Jan 5 01:00:00 1985 /***** hpcnoe:net.lang / uiucdcsb!wsmith / 11:39 pm Dec 16, 1984*/ > 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? I am suprised no-one mentioned Prolog (versus prolog)! It does use the 'case' of the first letter of a 'variable' for semantic information! In fact, words that begin with an uppercase letter are considered to be variables in the semi-traditional programming sense, while those that are lowercase are essentially constants. For example, father_of(joe, jack)? asks if constant 'joe' is the father of constant 'jack', whereas; father_of(Joe, jack)? asks if ANYONE is the father of jack (poor fellow!). The difference is in the case of the word. Of course, a more generally followed Prolog style would have the second inquiry as; father_of(Whom, jack)? which makes it a tad easier to see that it is a variable, eh? A more interesting idea is to have the compiler dynamically analyze the input program and decide for itself whether a given lexical token (word) is a variable or not. 'C' tries to do this for generation of error messages to a small extent - consider the difference between the two code fragments; silly() { junk; } and silly() { junk(); } The first will generate an error message to the effect that variable 'junk' is not declared, while the second generates a loader error that the ROUTINE junk is undefined! (Much more straightforward that Pascal, where it's anyones guess how a compiler distinguishes between a call to a procedure with zero parameters, or perhaps a better example, a function with zero parameters, and an undeclared variable (ie function test : integer; begin test := 3; end; begin a := test; b := test1; end. does YOUR compiler generate the correct error messages?) (Probably: pascal cheats by forcing all routines to be defined BEFORE their first occurance in the program. *sigh* another half-witted fix...) Anyway, what I think would be useful would be for the compiler to be intelligent enough to figure out that a line like 'junk;' makes no sense and performs no operation if junk is a variable, so it would assume that it was a function call, outputting an appropriate warning message to the screen. In a similar vein, a casual bit of code that I once erroneously had which took HOURS to find was; i == 3; as a line in a program. This also doesn't make any sense as an independent statement, and the compiler could again flag it and change it to read 'i = 3'. Comments? Dave Taylor WARNING: (insert disclaimer here)