Re: Equates, object size and speed
- From: jeffk75067@xxxxxxxxxxx
- Date: Tue, 29 Jan 2008 12:11:18 -0800 (PST)
RE:
I actually find that less clear than this:
EQU DRNAME.AMC to 1
This is the approach I prefer, also. It has the advantage of being
readable for any situation where the attribute must be referenced:
Dimensioned array access:
X = DEBTOR( DRNAME.AMC )
Dynamic array access:
X = DEBTOR< DRNAME.AMC >
READV / WRITEV:
READV X FROM DEBTOR.FILE, DEBTOR.ID, DRNAME.AMC THEN...
WRITEV X ON DEBTOR.FILE, DEBTOR.ID, DRNAME.AMC
You can also use these (numeric) equates for dynamic array work
(INSERT, DELETE, EXTRACT, REPLACE), and in LOCATE statements.
Finally, you can use the same names for your EQUs as you use for DICT
items, so BASIC and TCL users "say" the same thing when referring to a
given field.
Using the EQU DRNAME TO DEBTOR( DRNAME.AMC ) doesn't work for me
because it's too limiting:
You HAVE to use MATREAD, creating maintenance work when new fields
are added to a record. (You can defer this somewhat by DIMming larger
than necessary, but eventually...
You CAN'T use the EQU symbol if you're processing more than one
record, because it's tied to the one named DIMmed array. (Consider how
you'd compare two debtor records, for example.)
You "lose" the visual connection between the field and the record
it belongs to. What I mean is this: If you have an app with debtors
and, say, doctors, what does DRNAME mean? Is it a debtor's name, or a
doctor's name? Using numeric equates, you write one of these lines of
code:
X = DEBTOR( DBTNAME.AMC )
<< or >>
Y = DOCTOR( DOCNAME.AMC )
Later, when reading the code, there's no question as to the what's in
X or Y. It's right there in the source code you're looking at; there's
no need to refer back to the EQUs.
As stated in the original post (and repeated a couple of times in this
thread), speed just isn't an issue these days. (With the exception of
high-volume batch processing jobs.)
.
- Follow-Ups:
- Re: Equates, object size and speed
- From: Dale
- Re: Equates, object size and speed
- From: Peter McMurray
- Re: Equates, object size and speed
- From: frosty
- Re: Equates, object size and speed
- References:
- Equates, object size and speed
- From: Tom Phillips
- Re: Equates, object size and speed
- From: Excalibur
- Re: Equates, object size and speed
- From: Chandru Murthi
- Re: Equates, object size and speed
- From: Excalibur
- Re: Equates, object size and speed
- From: Chandru Murthi
- Equates, object size and speed
- Prev by Date: Re: OS QPointer - write native format
- Next by Date: DIM vs. Dynamic
- Previous by thread: Re: Equates, object size and speed
- Next by thread: Re: Equates, object size and speed
- Index(es):
Relevant Pages
|
|