Hi Abe,
The answer is in doc\xhb-diff.txt:
Regards,
Klas
### $ OPERATOR EXTENSIONS (arrays and hashes) ###
=======================================================
In Harbour and xHarbour $ operator can be used to check if some key
or hash pair belongs to hash, f.e.:
? "abc" $ { "qwe"=>100, "abc"=>200, "zxc"=>300 }
In xHarbour $ operator can be also used to check if value belongs
to array. It works like ASCAN() but with exact comparison for strings,
f.e.:
? "abc" $ { "qwe", "abc", "zxc" } // result .T.
? "a" $ { "qwe", "abc", "zxc", { "a" } } // result .F.
By default Harbour core code does not allow to use $ operator for arrays
and generate the same as Clipper RT error but it has strong enough OOP API
to allow adding such extension without touching core code even by user at
.prg level. It was implemented in Harbour in XHB.LIB so both compilers
can compile and execute this code:
#ifndef __XHARBOUR__
#include "
xhb.ch"
#endif
proc main()
? "abc" $ { "qwe", "abc", "zxc" } // result .T.
? "a" $ { "qwe", "abc", "zxc", { "a" } } // result .F.
return
Warning! Xbase++ also support $ operator for arrays but it makes non
exact comparison so ` "a" $ { "abc" } ' gives .T. in Xbase++
and .F. in xHarbour or in Harbour when xHarbour compatibility
library is used. Harbour users who need strict Xbase++
compatibility
should create own code to overload $ operators used for arrays
which will follow exact Xbase++ rules.
CLIP also has some code for such extension but it has two bugs.
1-st is a semi bug: it uses non exact comparison but reverts
arguments so ` "abc" $ { "a" } ' gives .T.
2-nd which is critical: it has wrong stop condition so does
not stop scanning when locates 1-st matching item. It should
be fixed and I do not know what will be the final CLIP behavior.