| | Forth question Steven J. Morris
|
| | 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? (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
| | |
| | | | RE: Forth question Ralph Hempel
|
| | | | (...) 1 CONSTANT ONE Recall that CONSTANT is a *defining* word, just like the ":" It makes a name in the dictionary, in this case "ONE" and then links to a special bit of code that is executed every time ONE is interpreted. It grabs the value out of (...) (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
| | | | |
| | | | | | Re: Forth question Steven J. Morris
|
| | | | (...) 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)
|
| | | | |
| | | | | | Re: Forth question Steven J. Morris
|
| | | | | (...) Actually the various reasons are simple so I might as well state them. The serial port is not available at the time I want to create a constant because the serial port will be broken and therefor can't be used as the forth input stream. I am (...) (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
| | | | | |
| | | | | | Re: Forth question Ernst de Ridder
|
| | | | | (...) You might want to try : zzz S" CONSTANT ONE" EVALUATE ; 1 zzz (...) I think VALUE can be used for that. Ernst (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
| | | | | |
| | | | | | CONSTANTS and VALUES in pbForth Ralph Hempel
|
| | | | (...) There are a couple of things in this note. One is an introduction to CREATE DOES> and the other is a solution to your actual problem. Basically, what CREATE DOES> does is separate the run-time and compile time semantics of a word. This is (...) (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
| | | | |
| | | | | | grasshopper learns new tricks Steven J. Morris
|
| | | | CREATE DOES>, VALUE and EVALUATE. Thank's guys. These will all enhance my code. I knew about CREATE DOES> but never really understood it. Your description pushed me finally over the edge of basic comprehension. EVALUATE is really cool and VALUE is (...) (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
| | | | |
| | | | | | RE: grasshopper learns new tricks Ralph Hempel
|
| | | | (...) Phew, it pushes most people over the edge of sanity.... (...) But the dew is still fresh on the grass, young apprentice, and the hot sun may yet inflict harm to you in unexpected ways... Cheers, Ralph Hempel - P.Eng ---...--- Check out pbFORTH (...) (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
| | | | |
| | | | | | Re: grasshopper learns new tricks Steven J. Morris
|
| | | | (...) Considering that it has been almost 20 years from my first attempt you should rather say "about time." CREATE DOES> is important to me because it is sort of a minimalist object creator in the sense that it allows the creation of classes of (...) (25 years ago, 24-May-00, to lugnet.robotics.rcx.pbforth)
|
| | | | |