[Info-vax] puzzled by DCL symbol substitution
Phillip Helbig---undress to reply
helbig at astro.multiCLOTHESvax.de
Sat Jan 7 10:12:32 EST 2012
In article
<7d997e21-b5be-488e-aa3d-e835519176b4 at z1g2000vbx.googlegroups.com>, AEF
<spamsink2001 at yahoo.com> writes:
> It works because the apostrophes force ampersand substitution to take
> place.
That's obviously what is going on. However, is it actually mentioned in
the documentation? I just fired up BOOKREADER and read the section on
this in the 7.1 User Manual, but didn't see this mentioned.
> $ VERIFY_PROCEDURE = "''F$PARSE(F$ENVIRONMENT("PROCEDURE"),,,"NAME")'_VERIFY"
>
> The second line is "magic", too. Quotation marks normally have to be
> doubled inside a quoted string, but this is the exception. The
> quotation marks around PROCEDURE and NAME must *not* be doubled. For
> some reason it's different when lexical functions are used in this
> manner.
Right. This is another case, though, and is documented.
> Ampersand changes VERIFY_PROCEDURE to its value. Then the apostrophes
> change that result to *its* value. Then the resultant string is
> assigned to VERIFY_PROCEDURE.
Right. Looking up ampersand, one reads that it is not evaluated inside
quotation marks. Presumably this should also say: unless it is inside
quotes, in which case it is evaluated before the quotes are evaluated.
> As you can see in the second case, the symbol "A" gets its value
> before any subsequent code is executed.
Right.
> > Does anyone know who invented this?
>
> The authors of DCL.
:-)
> No, this is not documented in the manuals,
Why not?
> 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.
The difference is that the latter is documented.
More information about the Info-vax
mailing list