On Mon, 10 Nov 2008, Lorenzo Fiorini wrote:

Hi Lorenzo,

> On Mon, Nov 10, 2008 at 12:29 PM, Szakáts Viktor <[EMAIL PROTECTED]> wrote:
> > Experienced hash users should say the final word.
> We use hashes extensively and the RTE is useful to avoid mispelled
> keys exactly like arrays gets RTE if accessed out of bounds.
> When it's expected we use:
> #xtranslate GETKEYORDEFAULT( <h>, <k>, <v> ) => iif( hHasKey( <h>, <k>
> ), hGet( <h>, <k> ), <v> )
> or
> #xtranslate GETKEYOREMPTY( <h>, <k> ) => iif( hHasKey( <h>, <k> ),
> hGet( <h>, <k> ), "" )

To avoid confusion.
In practice we are talking about two functions where we can remove
RT errors: hb_hGet() and hb_hDel(). We do not want to touch RT errors
in direct hash access. Removing RT errors from hb_hDel() will make their
behavior similar to aDel() function which does not generate RT error
in code like aDel( {}, 2 ). With hb_hGet() it's a problem with returning
value when key does not exists because hash can hold any values.
So we can leave it as is and reduce the problem to:
   hb_hDel( {=>}, "key" )
Should it generate RT error or not.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to