On Tue, 15 Jul 2008, Mindaugas Kavaliauskas wrote:

Hi Mindaugas,

> >>and I would expect result "2" (the last one) to be printed.
> >This we can discus. For sure it should give the same results
> >as HB_HASH() and now they are reverted.
> >So we should change HB_HASH() function or the order of variables
> >stored for HB_P_HASHGEN PCODE.
> >What do you prefer?
> I think it's more clear, if the last value remains valid.
>   aI := {key1=>val1, key2=>val2, key3=>val3}
> is something like:
>   aI := {=>}; aI[key1] := val1; aI[key2] := val2; aI[key3] := val3

At the beginning I though about adding warning message like
"repeated hash key ignored" and in such case it's better to
accept the first value. But it does not resolve the problem
when keys are not literal expressions and repeated values
cannot be detected at compile time. I also cannot revert the
order of variables stored for HB_P_HASHGEN because it will
change the order in which of user expression are evaluated
f.e. { ++i=>"A", ++i=>"B", ++i=>"C" } so I decided to change
it at runtime and added new function hb_hashAddNew() which
works like hb_hashAdd() but does not overwrite existing values.

best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to