I typically restart the application by restarting the Forth system and >>reloading the application source.
With ample memory it is not worthwhile to restart the Forth system.
With ciforth making executables is easy.
This alternative allows to
pass parameters to the executable.
#! /usr/bin/env gforth
albert@spenarnc.xs4all.nl writes:Merely inconvenient.
I typically restart the application by restarting the Forth system and >>>reloading the application source.
With ample memory it is not worthwhile to restart the Forth system.
As if that was costly.
It is so easy that it pays off not loading the source several times,With ciforth making executables is easy.
Easy is still harder than doing nothing.
With a Forth system and an OS (like Unix) that have good support for >executing scripts, the Forth source code can just serve as script; if
you want to call the script without mentioning the Forth system, you
can put the Forth system in the hash-bang line in Unix, e.g.
#! /usr/bin/gforth
or
#! /usr/bin/env gforth
as first line (the latter is beneficial if you don't know whether
gforth is in /usr/bin or /usr/local/bin on the systems where the
script is invoked). Ok, you still have to do that and make the file >executable, but you don't have to repeat that every time you change
the program source, while you have to rebuild the binary executable
every time, however easy that may be.
Here's an example:
[/tmp:147807] cat <<EOF >example
#! /usr/bin/env gforth
: echo ( -- )
begin
next-arg 2dup 0 0 d<> while
type space
repeat
2drop ;
echo cr bye
EOF
[/tmp:147808] chmod +x example
[/tmp:147809] ./example a b c d
a b c d
If I edit example, I don't have to repeat the chmod.
- anton
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 475 |
Nodes: | 16 (2 / 14) |
Uptime: | 19:16:28 |
Calls: | 9,487 |
Calls today: | 6 |
Files: | 13,617 |
Messages: | 6,121,093 |