Static scoping in BCPL (was Re: Are nested functions legal in ANSI/ISO Standard C) 
Author Message
 Static scoping in BCPL (was Re: Are nested functions legal in ANSI/ISO Standard C)


Quote:


>>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.

Quote:
>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



Tue, 17 Dec 1996 02:49:40 GMT  
 Static scoping in BCPL (was Re: Are nested functions legal in ANSI/ISO Standard C)

Quote:

>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.

As I understand it, variables declared in a STATIC $( ... $)
block (at least outside of a function) have file scope comparable
to C file scope for static variables.
The really bizarre thing are the GLOBAL $( ... $) declarations:
what you get is essentially a vector, shared by all modules, to
your global variables (including run-time library routines).  
BCPL does not rely on the conventional methods for linking
external names.

--
Miguel Carrasquer         ____________________  ~~~
Amsterdam                [                  ||]~  



Tue, 17 Dec 1996 04:39:09 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. I am not deaf, but am I mute?

2. Who cares about the ANSI/ISO Standard?

3. Reporting defects in the ANSI/ISO COBOL Standards

4. ABSOLUTELY last chance to comment on next COBOL ANSI/ISO Standard

5. SIZE ERROR, Truncation, and what the ANSI/ISO Standard says

6. ISO COBOL Standard available from ANSI online store

7. ANSI, ISO, IEEE STANDARD .. FORTRAN FAQ's

8. proposed scoping rules for nested functions...

9. standards: ANSI LISP vs. ISO/IEC ISLISP

10. ANSI standard for functions

11. OEM to ANSI / ANSI to OEM function

 

 
Powered by phpBB® Forum Software