tobold.org

correct • elegant • free

△ Comp.lang.c △

◅ Are nested functions legal in ANSI/ISO Standard C

fopen doesn't open! ▻

Static scoping in BCPL

In article <Cs4FGz.56s@inter.nl.net>, Miguel Carrasquer
<mcv@inter.NL.net> wrote:
>In article <2upkl5$3k@tank.pipex.net>, Tim Goodwin <tim@tank.pipex.net> wrote:
>>You should also look at the BCPL approach to block structure---it's
>>interestingly different from both Pascal and C.
>
>That would be the VALOF $( ..block.. RESULTIS expr .. $) construct,

That's not what I was thinking of, actually (although it's a very nice
construct; I wish it had made it into C).

In BCPL it is legal to nest procedures, but all variable references must
be fully global, or fully local: inside an inner procedure, variables
local to the outer procedure are out of scope.  Thus, relative to C, you
get some additional name hiding, but the compiler still doesn't have to
maintain static links.

This probably makes Algol afficionados weep, but it's certainly
pragmatic.

I don't believe BCPL has file scope (which is about the nearest
equivalent in C), but I may be wrong.

This doesn't have too much to do with C any more.  Followups to
comp.lang.misc.

>Ah, Cambridge, of course!

But the smattering of BCPL I know I learnt in Canterbury :-).

Tim.
--
Tim Goodwin        | "I will always write it the second way, so if
Public IP Exchange | you're optimizing for contrariness, it's obviously
Cambridge, UK      | better to do it the first way." -- Larry Wall

Original headers:

From: tim@tank.pipex.net (Tim Goodwin)
Newsgroups: comp.lang.c,comp.lang.misc
Subject: Static scoping in BCPL (was Re: Are nested functions legal in ANSI/ISO Standard C)
Followup-To: comp.lang.misc
Date: 30 Jun 1994 19:49:40 +0100
Organization: PIPEX, 216 Science Park, Cambridge CB4 4WA, England
Message-ID: <2uv444$7pt@tank.pipex.net>
References: <CrxCwo.D48@ennews.eas.asu.edu>
  <1994Jun26.225501.6625@newsgate.sps.mot.com> <2upkl5$3k@tank.pipex.net>
  <Cs4FGz.56s@inter.nl.net>

△ Comp.lang.c △

◅ Are nested functions legal in ANSI/ISO Standard C

fopen doesn't open! ▻