🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2151

Re: Request For Comment About Handling Of Globals

#2151
From: Charles Lindsey
Date: Fri, 16 Nov 1990 10:10
23 lines
1539 bytes
In <242@smds.UUCP> rh@smds.UUCP (Richard Harter) writes:


>The issue at hand is globals.  In C there are three levels of scope --
>program global, source file global, and block.  Fortran also has
>three, blank common, labelled common, and subroutine/function. In
>many languages with block structure inner blocks inherit variables
>from outer blocks.  And so on.  The common (you should excuse the
>expression) thread is that one wants to share access to data across
>procedures.  In the course of doing this one wants to avoid nasty
>things like name space pollution and ensure nice things like data
>hiding and restricted access.

What you want is variables whose "extent" (i.e. lifetime) is forever, but
whose "scope" is restricted to the bodies of the procedures which need to
share them.

What you want, therefore, is a modules facility, as in Modula-2 or Ada (where
they are called packages) - not that those particular languages have
necessarily made a perfect job of modules.

My feeling is that, with a decent modules system, you can do away with
classical block structure altogether.
Technical Details
Message-ID: <chl.658750215@m1>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!mucs!chl
References: <242@smds.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucbvax!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!mucs!chl
From: chl@cs.man.ac.uk (Charles Lindsey)
Newsgroups: comp.lang.misc
Subject: Re: Request For Comment About Handling Of Globals
Message-ID: <chl.658750215@m1>
Date: 16 Nov 90 10:10:15 GMT
References: <242@smds.UUCP>
Organization: Dept. Of Comp Sci, Univ. of Manchester, UK.
Lines: 23