Reading up on twins I see the documentation says that the built-in TWIN in
words like CONSTANT is automatically bypassed if you use an explicit TWIN,
as in the example. If I read the source right, this is done _automatically_
by the ?UNIQUE in WID-HEADER . This is a test to see if a word of the same
name already exists. If not, a twin is created; if so, it is not. That
leads me to the following observation: the automatic bypass of such words
is dangerous. Say I'm using the interpreter to create target structures and
am depending on the twin for help. Since my source is so large I don't
realize that I had previously defined an unrelated host word with the name
I've chosen for the target word ( try1 ). Thereafter when I use try1 in the
interpreter I'm expecting to get the twin value but instead get the host
value. This goes unnoticed because constant automatically bypasses it
(suppressing hidden definition warning). Its seems better to warn when a
twin is automatically being bypassed, suppressing possible with some word
like -TWIN or -?.
________________________________________
c:\temp\temp.f source:
host
: try1 0 ;
\ ...
\ really big app
\ ...
target
1 constant try1
2 constant try2
CR
interpreter
try1 . CR
try2 . CR
target
try1 . CR
try2 . CR
________________________________________
SwiftX output:
include c:\temp\temp.f
0
2
1
2
ok
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Fri Jan 25 2002 - 07:45:47 PST
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.