Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!texbell!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.misc Subject: Re: Anyone want to design a language? Message-ID: Date: 11 Mar 90 02:19:28 GMT References: <22569:05:10:24@stealth.acf.nyu.edu> <8475@wpi.wpi.edu> <24123:04:14:07@stealth.acf.nyu.edu> <1966@l.cc.purdue.edu> <191@gollum.twg.com> <78=1NPDxds13@ficc.uu.net> <16136@haddock.ima.isc.com> Reply-To: peter@ficc.uu.net (Peter da Silva) Organization: Xenix Support, FICC Lines: 50 In article <16136@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes: > You'd need to tweak the syntax to distinguish a two-exit loop from two > adjacent loops, of course. Yeh, I though of this: do statement while(expr) statement ... > (Note: If it's really a *new* language, rather than a suggestion for the next > version of C, then you don't need to deprecate things--you simply remove them > immediately. There's no backward compatability problem.) Good point. We'll use gotos instead. > I must object. The whole point of C's for-statement is to put all the loop > control in one place, at the top of the statement. This looks like a step > backwards. We can put it back later. Let me be a literal minded language purist for a while. A good macro facility (like lisp's) that works within the syntax of the language can be used to put it back... macro "for(@?initial; @?test; @?final) @body" { @if(?initial) @initial; while(@if(?test) @test @else true) { @body; 1: @if(?final) @final; } 2: } macro "continue" { goto forward(1); } macro "break" { goto forward(2); } > And isn't that clause "while (true)" a no-op in this language? It provides a target for "continue". But since we're using gotos instead, let's leave that out. -- _--_|\ `-_-' Peter da Silva. +1 713 274 5180. . / \ 'U` \_.--._/ v