Path: utzoo!utgpu!watmath!clyde!att!ihlpb!nevin1 From: nevin1@ihlpb.ATT.COM (Liber) Newsgroups: comp.lang.misc Subject: Re: Expression Based Language Message-ID: <9310@ihlpb.ATT.COM> Date: 30 Dec 88 22:20:49 GMT References: <3300001@uxg.cso.uiuc.edu> <3290002@hpctdls.HP.COM> <4505@xenna.Encore.COM> <2583@ficc.uu.net> Reply-To: nevin1@ihlpb.UUCP (55528-Liber,N.J.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 37 In article <2583@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: >In article <4505@xenna.Encore.COM>, pierson@mist (Dan Pierson) writes: >I once modified a version of the small-C compiler >to make 'C' a completely expression-based language. The changes are really >very minor (at least for that case... I don't know quite how full 'C' >would take it). This won't work too well in (full) C. The problem is that pure expression-based languages (like LISP) tend to be typeless as well. Having to return a specific data type severely limits the usefulness of making control-flow constructs (if, switch, for, etc.) expression-oriented. >> If C was an expression based language, the ?: expression would be >> totally redundant with a normal if statement (of course it would >> still be more compact). That is why the ?: operator is limited to returning values of the same type (or coersable type), while the if statement is not. >> This is not fantasy, the equivalent expressions exist and are useful >> in BLISS and Lisp. I agree. Side note: In LISP, I tend to think of the side-effect of an expression as what it does, while its main purpose is to return a value (eg: the side effect of setq is to assign a value to a variable, while its main effect is to return its value or the variable; I can't remember which). In Icon, I tend to reverse these definitions. Is it just me, or is there something about the different paradigms that switch these definitions? Happy New Year! -- NEVIN ":-)" LIBER AT&T Bell Laboratories nevin1@ihlpb.ATT.COM (312) 979-4751