(no subject)

From: ¤˝®]żA <tzer_at_ks.silkera.net>
Date: Thu, 08 Apr 1999 19:39:16 +0800

DIR

.

>From rvn_at_forth.com Thu Apr 8 13:55:20 1999
To: sftalk_at_forth.com
Message-Id: <m0000234_at_gerd.forthinc.com>
Date: Thu, 8 Apr 1999 13:55:20 -0700
From: " Rick VanNorman" <rvn_at_forth.com>
Subject: Snippet: code package encapsulation

This snippet is a shows one method of encapsulation. It implements
a wordlist scheme very similar to vocabularies, but each named package
simply returns its WID instead of automatically adding it to the
search order.

In conjunction with +ORDER and -ORDER, this is a useful wordlist
management utility. It is used extensively in the upcoming new
release of SwiftForth (soon..... i hope!).

Rick VanNorman

{ ====================================================================
(C) Copyright 1999 FORTH, Inc. www.forth.com

Encapsulation is the process of containing a set such that the
members are only visible thru a user-defined window. Ojbect oriented
programming is one kind of encapsulation. Another is when a word
or routine requires supporting words for its definition, but which
have no interest to the "outside" world.

-PACKAGE enforces a valid PACKAGE frame on the data stack. The
   frame is considered valid iff: the tag is the xt of wordlist,
   and the value returned by GET-CURRENT is either the wid of
   the package or its parent.

?PACKAGE checks the frame, and aborts if bad.

OPEN-PACKAGE creates a frame given a WID.

PACKAGE creates or re-uses a package, leaving a valid frame.

END-PACKAGE restores CONTEXT and CURRENT to their prior states.

PUBLIC changes CURRENT to the parent and
PRIVATE changes CURRENT to the package.
==================================================================== }

: -PACKAGE ( parent package tag -- flag ) ['] WORDLIST =
   SWAP GET-CURRENT = ROT GET-CURRENT = OR AND 0= ;

: ?PACKAGE ( parent package tag -- parent package tag )
   3DUP -PACKAGE ABORT" PACKAGE balance changed" ;

: OPEN-PACKAGE ( wid -- parent package tag )
   GET-CURRENT SWAP DUP SET-CURRENT
   DUP +ORDER ['] WORDLIST ;

: PACKAGE ( -- parent package tag )
>IN @ BL WORD FIND IF ( exists) NIP
      DUP >BODY CELL+ CELL+ @ ['] WORDLIST <> ABORT" Not a package"
>BODY CELL+ @ OPEN-PACKAGE EXIT
   THEN DROP >IN !
   1 STRANDS CREATE
      VLINK >LINK DUP , ['] WORDLIST , OPEN-PACKAGE
   DOES> CELL+ @ ;

: END-PACKAGE ( parent package tag -- )
   ?PACKAGE DROP -ORDER SET-CURRENT ;

: PUBLIC ( parent package tag -- parent package tag )
   ?PACKAGE THIRD SET-CURRENT ;

: PRIVATE ( parent package tag -- parent package tag )
   ?PACKAGE OVER SET-CURRENT ;

.

>From mail_at_forthcad.com Fri Apr 9 12:17:40 1999
To: sftalk_at_forth.com
Message-Id: <m0000235_at_gerd.forthinc.com>
Date: Fri, 9 Apr 1999 12:17:40 +0100
From: ForthCAD <mail_at_forthcad.com>
Subject: Open a "COM-Forth" working group

Just a proposal.

I have made a in-depth incursion in the COM technology. I think now it will be _very_ interesting to open a "COM-Forth" working group to implement _Components, COM, and ATL_ in SwiftForth.

Here is a piece of text from a Microsoft article:

"...Implementing COM compatibility in your language run time isn't trivial, but the benefits are great: once you do, you open up a whole world of already written and debugged COM objects for your use. And there's a wide market for the COM components you write the Giga Information Group estimates the current market at $400 million a year and expects it to be $3 billion in three years. (The COM-component market is growing faster than Microsoft!) Note that these market estimates are for third-party COM objects: they exclude COM components provided by Microsoft..."

Also,
COM have an intimate connexion with OOP and my OOF "virtual-method" implementation.
COM resolve the problem of licencing Forth library.

Is anyone interested to work in such a project ? It would be beautifull to have Forth-inc as project manager !

Charles Melice

.
Received on Thu Apr 08 1999 - 19:39:16 PDT


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.