Notes on Data Typeing
The strongest data typeing is when you bring a financial statement
generated by your print program to your CFO that says:
Money Made this Month 10000.00
Money Spent this Month 20000.00
Money Left over BU.RP
Wherein the programmer updates his resume and looks for another job.
From a standpoint of compilers, data typeing has another
function.
In a strongly typed language variables must be declared
before being used. This has a primary purpose in that it makes
compilers easier to write.
determine text fragment is a varible
lookup in table of variables
if not found send * warning and stop
substitue code that will push x number of bytes on stack
or pop x number of bytes from stack depending on if it's a lvalue or rvalue
and the declared data type has x number of bytes.
What is a byte is implementation specific.
All this does not imply that what is assigned to a variable
at runtime is correct. The programmer can still attempt to force
square pegs into round holes. Once again update resume...
So what does this all mean? Do we need to change our basic compilers?
I think not.
In an earlier thread i proposed a type declaration for a
"recordset" this was a little bit much. It's really a "itemset"
declare inventoryrec as array
desc as 1
uom as 2
cost as 3
price as 4
onhand as 5
end declare
dim invinstance as inventoryrec
matread invinstance from inv,iid ...
invinstance(uom) = "each"
Does this gain anything. Not really. the same could be done
without change to the compiler as
equate desc to 1
equate uom to 2
equate cost to 3
equate price to 4
equate onhand to 5
dim invinstance(5)
invinstance(uom) = "each"
It is always up to the programmer to make sure that "each" is
a valid data for uom.
it's always up to the programmer.
----------------------------------------------------------------------
James Roberts Computer Consulting 708/658-9409
----------------------------------------------------------------------