From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <406C42A4.8000607@swtch.com> From: Russ Cox User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031221 Thunderbird/0.4 MIME-Version: 1.0 To: 9fans@cse.psu.edu Subject: Re: [9fans] multiple inputs References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 1 Apr 2004 11:26:12 -0500 Topicbox-Message-UUID: 4c65cc2e-eacd-11e9-9e20-41e7f4b1d025 rog@vitanuova.com wrote: >>What do the 9fans think of hygenic macros? >> >> > >dunno what others think but i reckon macros (hygienic or not) make it >much harder to maintain a program. you have to get through the custom >syntax before you can start seeing what's really going on. > >if you need that kind of expressivity, consider writing an >interpreter, a translator or a preprocessor. > > I think it would be great if the C compiler had some sort of nice extension facility (call it hygenic macros with syntax) so that we could write alt { <- done => print("done\n"); c <-= val => print("sent val\n"); } But you're right, that would make it much harder to maintain the program. Instead we should content ourselves with writing Alt alts[3]; alts[0].c = done; alts[0].v = 0; alts[0].op = CHANRCV; alts[1].c = c; alts[1].v = val; alts[1].op = CHANSND; alts[2].op = CHANEND; switch(alt(alts)){ case 0: print("done\n"); break; case 1: print("sent val\n"); break; } which is much clearer and doesn't require us to wade through custom macro syntax. Russ