Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!david From: david@cs.washington.edu (David Callahan) Newsgroups: comp.lang.c++ Subject: Re: #pragma once (was Re: A solution to the multiple inclusion Message-ID: <9635@june.cs.washington.edu> Date: 30 Oct 89 14:59:08 GMT References: <14240@well.UUCP> <2082@plx.UUCP> <1989Oct27.163755.12976@paris.ics.uci.edu> <23464@cup.portal.com> Reply-To: david@june.cs.washington.edu.cs.washington.edu (David Callahan) Organization: Tera Computer Co., Seattle WA Lines: 35 In article <23464@cup.portal.com> John_-_Nagle@cup.portal.com writes: > > Common LISP has "require", which has the right semantics for this >situation. Perhaps we could use that keyword. > ... > So how about > > #require FILENAME > >as the one-time inclusion mechanism for C++. > > The ultimate goal is that all include files contain "require" statements >for everything they need, so that order of inclusion in the ".c" files isn't >an issue and the user of a library doesn't have to worry about including >too little or too much. I think you'd want some insulation from the vagaries of file systems. How about: #pragma require function "file" where "file" defaults to function if it is not provided. And in "file": #pragma provide function Another advantage of this mechanism is that header files could be collected into a library and some tool similar to "ranlib" used to cross-refedrence function to filename. Then of course, its one small step to treating every "class foo { ... }" as implying "provide foo". -- David Callahan (david@tera.com, david@june.cs.washington.edu,david@rice.edu) Tera Computer Co. 400 North 34th Street Seattle WA, 98103