Open Hovestar opened 3 years ago
Harbour does not support bit operators overloads, because there is no support for those operators at all: https://github.com/harbour/core/blob/master/doc/xhb-diff.txt#L1055
I think this is mainly due to Clipper compatibility clashes. & is a macro operator.
There is a FOR EACH overloading example though: https://github.com/harbour/core/blob/master/tests/foreach2.prg
This is likely at most something to document in xhb-diff.txt, but xHarbour supports these 6 class operator overloads, that harbour does not:
Also the naming convention, which can be used to override an operator, is different for xHb's
__OpContains
and hb's (Interchangeable?)__OPINCLUDE
and__OPINSTRING
Is the choice to not have the Bit operators and for each intentional?
As a note, since I haven't seen documentation for
for each
overloading in xhb this is the behavior:So calling
for each n in forEachReconObjectHolder():new(3)
will iterate through1
,2
,3
and then exit. From the iterate call, it first calls with a depth, 1, where you then can return. If you return something iteratable it will iterate through it and then call with a nDepth of 2. If an object is returned it then will call with the same depth and a step, and the value will reflect exactly what you return, even if it's nil. To break the loop you need to callbreak
at which point it will call with the next depth.