Article View: net.lang.forth
Article #368Re: Information Hiding in FORTH
From: jimc
Date: Mon, 14 Jul 1986 23:54
Date: Mon, 14 Jul 1986 23:54
37 lines
2081 bytes
2081 bytes
> 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! Other than this caveat, I thought the idea and the implementation were really first-class -- only a tiny bit of code. As a side note, compressing the headers might not always be a good idea, since the same Forth package had a tracer (hooked into NEXT) that printed out the names of the currently executing words and the top few values on the stack. I had a few words with headers missing that always screwed up the trace output. -- +----------------+ ! II CCCCCC ! Jim Cathey ! II SSSSCC ! ISC Systems Corp. ! II CC ! Spokane, WA ! IISSSS CC ! UUCP: ihnp4!tektronix!reed!iscuva!jimc ! II CCCCCC ! (509)927-5757 +----------------+ "With excitement like this, who is needing enemas?"
Technical Details
Message-ID:
<242@iscuva.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utcs!mnetor!seismo!nbires!hao!hplabs!tektronix!reed!iscuva!jimcReferences:
<12110@amdcad.UUCP> <622@uvacs.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!utcs!mnetor!seismo!nbires!hao!hplabs!tektronix!reed!iscuva!jimc From: jimc@iscuva.UUCP Newsgroups: net.lang.forth Subject: Re: Information Hiding in FORTH Message-ID: <242@iscuva.UUCP> Date: Mon, 14-Jul-86 19:54:42 EDT Article-I.D.: iscuva.242 Posted: Mon Jul 14 19:54:42 1986 Date-Received: Fri, 18-Jul-86 00:57:12 EDT References: <12110@amdcad.UUCP> <622@uvacs.UUCP> Reply-To: jimc@iscuva.UUCP (Jim Cathey) Organization: ISC Systems Corporation, Spokane, Wa. Lines: 37