entry at other than main (was w

mccaugh at s.cs.uiuc.edu mccaugh at s.cs.uiuc.edu
Tue Aug 22 15:04:00 AEST 1989


/* Written  1:40 pm  Aug 20, 1989 by chris at mimsy.UUCP in s.cs.uiuc.edu:comp.lang.c */
Re: the explanation of the second SNOBOL program:

> ...  At line 4, Z (global) is set to "Y"; at line 5, the variable
> named by X---and X is "Z", so this means the global Z---is set to
> whatever is named by Z (here the global Y) concatenated with the string
> "0", so this sets the global Z to "X0".  .....

Well, not quite. Given the program-fragment in question:

2:   X = 'Z'
3:   Y = 'X'
4:   Z = 'Y'
5:   $X = $Z '0'

The way this was explained led me (and others reading this) to believe
that the '$' operator de-referenced Z to produce 'Y'.  A clearer explana-
tion is that '$' maps the value of variable Z (the string 'Y') to the
variable Y; as an r-value, it is then the value of variable Y (= 'X')
which is concatenated to '0'. I really don't mean to sound pedantic
about this, but one glance at the macro implementation of SNOBOL  would
show how much is afoot with the '$' operator.



More information about the Comp.lang.c mailing list