[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subscripting vs expression (was RE: gnubol: refmod again (fwd)



> -----Original Message-----
> From: owner-gnu-cobol@wallace.lusars.net
> [mailto:owner-gnu-cobol@wallace.lusars.net]On Behalf Of Michael McKernan
 <snip>
>
> OK, that helps.  It still leaves the context sensitivity trying to
> distinguish subscripted ref's and separate expressions, though.  I
> would have hoped that could be done syntactically.
>
 <more snip>  And, of course, I remain annoyed if I can't
> distinguish a subscript from an expression without interrogating the
> symbol table.  (I suppose I should ask if nested subscripts are in
> the game.)

Again being new - and not knowing what you (all) have already dealt with and
what you haven't, the "pure" '85 Standard (actually '89 - because it uses
Intrinsic Function) "classic" example of where you can't tell whether
something is a subscript or an expression  - without checking the symbol
table is,

 Compute NumVal = Function Max (Foo (A + 3))

If Foo is in a single level table, then "(A + 3)" is a subscript (using
relative subscripting) - and you are passing a single argument to the MAX
function.  If foo is NOT in a table, then "(A + 3)" is an expression - and
you are passing two arguments to MAX.

This may have been where your thread started, but it certainly is a "well
known restriction" in the COBOL language definition.

P.S.  Yes, nested subscripts are allowed in the next Standard - as are
user-defined functions - so you should see what the committee is TRYING to do
to make "side-effects" well defined.  I recommend taking/drinking your
chemical of choice before reading THOSE new rules.


Bill Klein
  wmklein <at> ix.netcom.com


--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.