>> BTW, maybe it would be also useful to add 
>> HB_FIELDPUT()/HB_FIELDGET() which would also 
>> accept field _name_ as parameter.
> 
> Interesting proposition though it will make the same job as
> FIELDGET( FIELDPOS( <name> ) ) / FIELDPUT( FIELDPOS( <name> ), <xVal> )
> so I do not know if it's really necessary. Anyhow if table has field
> names which are not valid Clipper identifiers then accessing by name
> with above functions is the only one method to get/set field value so
> we should rather think about efficient method to access such fields
> in expressions, i.e. we can add support for FIELD->'<fieldName>'
>   FIELD->'FIRST NAME' := "Phil"

It's a much more "hidden" kind of extension, so 
at first sight I don't like it too much.

I'm proposing HB_FIELDGET() because many times 
FIELDGET( FIELDPOS( n ) ) combination is used 
(sometimes in time-critical loops), and proposed 
solution could make this more compact and faster.

> We can also use functions like proposed by you HB_FIELDPUT()/HB_FIELDGET()
> but in such case they should generate RTE on wrong field names and of
> course functions are not such flexible as native syntax.

IMO HB_FIELDGET() should return NIL if the name 
doesn't exist, just like FIELDGET() returns NIL 
if the field position doesn't exist. Similarly, 
HB_FIELDPUT() should return logical value just 
like FIELDPUT().

There is existing FIELDPOS() to find out if a name 
exist.

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to