|
On Wed, May 24, 2000 at 11:09:57AM +0000, Steve morris wrote:
> Ralph Hempel wrote:
> >
> > > I'm trying to define a constant in a compiled word.
> > >
> > > : zzz 1 CONSTANT ONE ;
> > >
> > > I know its not right. It tries to compile "ONE" which is not
> > > what is wanted. What is the right way to say this?
> >
> > 1 CONSTANT ONE
> >
> > Recall that CONSTANT is a *defining* word, just like the ":"
>
> I still want to create a constant from within a definition. I
> have an initializing word that will calculate the value of
> the constant. For various reasons I can't do this calculation
> except within the runtime behavior of the word.
You might want to try
: zzz S" CONSTANT ONE" EVALUATE ;
1 zzz
> This is not critical. I have since replaced the constant
> with a variable that I define in advance and then set
> within my word, but then I have to use variable semantics
> instead of constant semantics to access the value, which is
> not what I wanted. I get around that by defining a new
I think VALUE can be used for that.
Ernst
--
Ernst de Ridder - hnridder@informatik.uni-rostock.de
Universitaet Rostock - Lehrstuhl fuer Theoretische Informatik
Albert Einstein Str. 21 - D-18051 Rostock - Germany
http://wwwteo.informatik.uni-rostock.de/~hnridder
|
|
Message is in Reply To:
| | Re: Forth question
|
| (...) I still want to create a constant from within a definition. I have an initializing word that will calculate the value of the constant. For various reasons I can't do this calculation except within the runtime behavior of the word. This is not (...) (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
9 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|