Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!rochester!pt.cs.cmu.edu!a.gp.cs.cmu.edu!koopman
From: koopman@a.gp.cs.cmu.edu (Philip Koopman)
Newsgroups: comp.lang.forth
Subject: Strongly typed Forth??
Message-ID: <3067@pt.cs.cmu.edu>
Date: 21 Sep 88 15:05:16 GMT
Sender: netnews@pt.cs.cmu.edu
Organization: Carnegie-Mellon University, CS/RI
Lines: 26

A year or two ago, Hans Niewenhuser (I *know* I spelled it incorrectly!!)
gave an argument at the Rochester Forth Conference that Forth has the
potential to be a strongly typed language.  The argument for this is based
on the use of CREATE ... DOES> ...  (or whatever your dialect calls it).

In most implementations, the DOES> re-points the code field to the DOES> ...
clause code.  So, if you make each kind of variable with its own DOES>
field, then each kind of variable has a different CFA value.  The CFA
value then contains the type information.  A clever compiler (especially
an infix expression processor extension) can exploit this typing information
to do automatic type conversions.

For example:

: VARIABLE   CREATE    0   ,  DOES> ;
: DVARIABLE  CREATE  0.0  D,  DOES> ;

VARIABLE VA
VARIABLE VB

In this example, VA and VB will have different CFA values.

  Phil Koopman                koopman@maxwell.ece.cmu.edu   Arpanet
  5551 Beacon St.
  Pittsburgh, PA  15217    
PhD student at CMU and sometime consultant to Harris Semiconductor.