You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
class forEachRecnoObjectHolder
data nTop
method iterate operator "FOR EACH"
method new constructor
endclass
method new(nTop)
default nTop to 2
::nTop := nTop
return self
method iterate(nDepth,nStep)
if nDepth == 1
return self
endif
if nDepth > 2
return nil
endif
if nStep > ::nTop
break
endif
return nStep
So calling for each n in forEachReconObjectHolder():new(3) will iterate through 1,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 call break at which point it will call with the next depth.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: