Newsgroups: comp.lang.misc Path: utzoo!utgpu!tmsoft!mason From: mason@tmsoft.uucp (Dave Mason) Subject: Re: colon-equal vs equal Message-ID: <1988Dec30.025022.2883@tmsoft.uucp> Followup-To: comp.lang.misc Summary: PL/I is worse yet. + some actual content relevant to the subject line Reply-To: mason@tmsoft.UUCP (Dave Mason) Organization: TM Software Associates, Toronto References: <3300001@uxg.cso.uiuc.edu> <3290002@hpctdls.HP.COM> <2567@ficc.uu.net> Date: Fri, 30 Dec 88 02:50:22 GMT In article <2567@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: >This has nothing to do with :=/= versus =/==. This has to do with C being an >expression-based language and Pascal being a statement-based language. There >are expression-based languages which use := and allow you to say things like >"if flag := f1 and f2 then...". What it really has to do with is that something that your fingers learn to do: if abc = def then ghi :=jkl; in Pascal becomes: if (abc = def) ghi := jkl; occasionally when you are writing in C (for the first 2-3 years after switching (may your Deity help you if you don't in fact switch, but alternate back and forth :-)). The compiler nicely points out the :=, but leaves you with the nasty bug: if (abc = def) ghi = jkl; which is your finger's mistake, not even your brain....can be a very hard bug to find. > >Just so long as you have two tokens. If you want to flame a language, try >BASIC ("if a = b then a = c"... the first is a comparison, the second an >assignment). If you want to flame a language, try PL/I: if if = then then then = else else else = if; (there may be some ';' missing, but this is an otherwise legal statement!) The problem is that there aren't any REAL keywords. The parser must be a zoo! (...and while we're PL/I bashing, how about: i = 25/3; which assigns some WEIRD value like 5 to i because of weird default typing & coercion rules!) But there are some 'features' :-) in the language: e.g. substr is a function that takes part of a string, and bit is a function that converts an integer into a string of bits: substr(bit(i),6,17) = substr(bit(j),3,17)) transfers a 17 bit field between part of two integers. Details may be off, as it's been about 5 years since I wrote my one (1) PL/I program (2000 lines!), but the principle's right. I think the committee that designed the language was on acid most of the time. ../Dave