[Info-vax] puzzled by DCL symbol substitution
AEF
spamsink2001 at yahoo.com
Sat Jan 7 08:49:11 EST 2012
On Jan 7, 8:36 am, AEF <spamsink2... at yahoo.com> wrote:
> On Jan 7, 7:19 am, hel... at astro.multiCLOTHESvax.de (Phillip Helbig---
[...]
>
> Example:
>
> $ ZERO = "ONE"
> $ ONE = "TWO"
> $ TWO = "THREE"
> $
> $ A = "''ZERO'"
> $ SH SYM A
> A = "ONE"
> $
> $ A = "''&ZERO'"
> $ SH SYM A
> A = "TWO"
> $
> $ A = "&ZERO"
> $ SH SYM A
> A = "&ZERO"
> $
>
> As you can see in the second case, the symbol "A" gets its value
> before any subsequent code is executed.
>
>
>
> > Does anyone know who invented this?
>
> The authors of DCL.
>
> No, this is not documented in the manuals, but that's how it works. On
> the other hand, isn't this just like the apostrophes forcing the
> lexical function to be evaluated in line 2 or your procedure? It is.
> It's the same thing. Lexical substitution is normally done during
> phase 3, but the apostrophes force it to be carried out in step 1.
>
> AEF
Here's another fun one:
$ SET VERIFY
$ TYPE COMMENT.COM
$ ! DIR = '&DIR'
$ @COMMENT
$ ! DIR = 'DIRECTORY/SIZE=ALL/DATE /WIDTH=(FILE=29,SIZE=7)'
$
There are more fun things that can be done with the ampersand. I'll
post them later when I have time.
AEF
More information about the Info-vax
mailing list