🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.forth
Article #369

Re: Information Hiding in FORTH

#369
From: Thomas Almy
Date: Wed, 16 Jul 1986 14:03
46 lines
2156 bytes
In article <242@iscuva.UUCP> jimc@iscuva.UUCP (Jim Cathey) writes:
>> I have been recently thinking of a way to implement something like the
>> 'C' static scoping type in forth.  This would allow a word or group of
>> words to use a VARIABLE without letting the VARIABLE be visible outside
>> the group; something like:
>
>I believe map-Forth (Michael A Perry's version for my old CompuPro 68000)
>included the words:
>
>INTERNAL
> <<boring and/or dangerous words to be hidden here>>
>EXTERNAL
> <<the visible stuff>>
>MODULE     (actually does the work)
>
>I recall that both INTERNAL and EXTERNAL merely left addresses on the 
>data stack, and that MODULE patched the vocabulary search chain to
>miss the internals.  Woe be unto him whose internal or external definitions
>which (on purpose or not) swallowed any of the data stack or left any extra!

Which caused me to define these as so:

: INTERNAL  LATEST  12543 ;

: EXTERNAL  12543 <> ABORT" Where is INTERNAL?"
            LATEST N>LINK 
            25314 ;

: MODULE    25314 <> ABORT" Where is EXTERNAL?"
            ! ;


(This code will not work for Laxen & Perry F83 because of the hashed 
 vocabularies)

My current favorite technique (because it allows referencing the hidden words)
is a function which moves a word into a different vocabulary.

FooVoc DEFINITIONS BarVoc  REVOC FooBar

moves word FooBar from vocabulary BarVoc to vocabulary FooVoc.

The implementation is straightforward, but is very system dependent.

Tom Almy
Tektronix
Technical Details
Message-ID: <1626@tekgvs.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!topaz!ll-xn!nike!ucbcad!ucbvax!hplabs!tektronix!tekcrl!tekgvs!toma
References: <12110@amdcad.UUCP> <622@uvacs.UUCP> <242@iscuva.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!topaz!ll-xn!nike!ucbcad!ucbvax!hplabs!tektronix!tekcrl!tekgvs!toma
From: toma@tekgvs.UUCP (Thomas Almy)
Newsgroups: net.lang.forth
Subject: Re: Information Hiding in FORTH
Message-ID: <1626@tekgvs.UUCP>
Date: Wed, 16-Jul-86 10:03:41 EDT
Article-I.D.: tekgvs.1626
Posted: Wed Jul 16 10:03:41 1986
Date-Received: Fri, 18-Jul-86 04:29:06 EDT
References: <12110@amdcad.UUCP> <622@uvacs.UUCP> <242@iscuva.UUCP>
Reply-To: toma@tekgvs.UUCP (Thomas Almy)
Organization: Tektronix, Inc., Beaverton, OR.
Lines: 46