Harbour hash plus operator

Post Reply
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Harbour hash plus operator

Post by hua »

Does anyone know why the following code under Harbour generates RTE at line h1 + h2 unless I include xhb.ch/hbcompat.ch?

Code: Select all

#include "fivewin.ch"
#include "xbrowse.ch"
#include "xhb.ch"
function main()
  local h1 := {"A" => 1}, h2 := {"A" => 2, "B" => 3}, h3

  h3 := h1 + h2
  xbrowse(h3)
return nil
 
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
AntoninoP
Posts: 347
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy
Contact:

Re: Harbour hash plus operator

Post by AntoninoP »

as you can see in Harbour\contrib\xhb\xhbcomp.prg the xhb adds some operators to base types.
The pure harbour method is hb_HMerge
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour hash plus operator

Post by hua »

Thanks for satisfying my curiosity Antonino.
I rely heavily on xHarbour's Language Reference Guide when I start to use hashes. That's how I end up using the plus operator without knowing it's an alternative form for HMerge()/hb_HMerge()
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
Post Reply