Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!texbell!wuarchive!wugate!uunet!mcsun!inria!seti!jourdan From: jourdan@seti.inria.fr (jourdan martin joseph) Newsgroups: comp.lang.pascal Subject: Re: Fragmented Declaration Blocks Legal? Message-ID: <249@seti.inria.fr> Date: 18 Aug 89 13:10:11 GMT References: <35692@bu-cs.BU.EDU> Reply-To: jourdan@minos.inria.fr (Martin Jourdan) Distribution: comp Organization: INRIA Rocquencourt, Le Chesnay, France Lines: 37 In article <35692@bu-cs.BU.EDU> beh@bu-pub.bu.edu (Bruce E. Howells) writes: > >We're running ANSTO Pascal v3 here, and in an effort to cure some annoying >string errors, I've been looking at putting an "add-in" package of routines >to create the types, globals, and procedures I'll need. Much to my dismay, >I found that the following construct is legal, and works "properly": > [I deleted the example program in which type, var and procedure declarations were freely intermixed] > >Of course, this is just what I need to stick a bunch of code in there with >a single include (switching input to another file until eof) - but is it >really correct (or polite)? It seems to go directly against what I know of Pascal, but >it's there... Comments? > >Bruce E Howells, beh@bu-pub.bu.edu / engnbsc@buacca.bitnet > Just a lowly engineering undergrad at Boston University... Allowing free intermixion of several declaration parts (I mean "type", "const", "var", "procedure", etc.) is one of the most common extensions to Standard Pascal. This, as you discovered, is to ease the inclusion of complete related set of declarations, mainly for separate compilation. So use it if your compiler allows it. BTW, I remember an old implementation of Pascal which allowed file inclusion but forbade multiple/intermixed declaration parts. This was a mess because it forced you to split a set of related declarations into several files... Also, keep in mind that everything related to separate compilation (including the matters discussed above) is NOT Standard Pascal, so beware if you want to write portable code. It's certainly allowed (in one form or another) in the new ISO Extended Pascal Standard. -- Martin Jourdan , INRIA, Rocquencourt, France. My employers have no opinion and they guarantee my freedom of expression.