Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!sys.uea!cmp8118 From: cmp8118@sys.uea.ac.uk (D.S. Cartwright) Newsgroups: comp.lang.c Subject: Re: Why nested comments not allowed? Message-ID: <1309@sys.uea.ac.uk> Date: 21 Feb 90 11:21:04 GMT References: <236100027@prism> <7330017@hpcllak.HP.COM> <1990Feb19.143619.17663@uncecs.edu> <1975.25e0048c@wums.wustl.edu> Organization: UEA, Norwich, UK Lines: 47 Forgive me if I'm wrong (for this is just a guess) but perhaps the availability of nested comments is simply a decision by the original language designer based on the eventual implementation of the thing. For example, someone heavily into recursion would probably include nested comments, as they can then be dealt with recursively, something like : Function CommentAnalyse Do Get token If token = 'Open Comment' Call CommentAnalyse Until token = 'Close Comment' End Function (in a completely no-existent language that I just made up). On the other hand, they might not consider recursion. This would mean that an iterative method would have to be used to find the end of a comment. If, then, nested comments were required, a counter would have to be stored with details of how many 'Open Comment' tokens we had had so far. With no nested comments, it's much easier to do (no counter is needed): Function CommentAnalyse Do Get token Until token = 'Close Comment' End Function (in the same non-existent language). Perhaps I am talking utter rubbish, and language designers have better things to think about than how their design is going to be implemented. It just seems rather a coincidence that the two basic methods of processing (iteration and recursion) fall into line with the two types of comment (nested and non-nested). Anyone else got any thoughts ?? Can anyone categorically state that I'm wrong (my Programming Systems lecturer will probably rip my argument to bits, but that's nothing new) ?? If so, I'd appreciate your views. Dave C. -- Dave Cartwright, | cmp8118@uk.ac.uea.sys <- Here School of Information Systems, | cmp8118@uk.ac.uea.cpc780 <- Somewhere else University of East Anglia, | Just 'cos I'm thick ... Norwich, ENGLAND. NR4 7TJ. | ... don't take it out on ME !!