[Info-vax] puzzled by DCL symbol substitution
AEF
spamsink2001 at yahoo.com
Sat Jan 7 12:12:56 EST 2012
On Jan 7, 10:12 am, hel... at astro.multiCLOTHESvax.de (Phillip Helbig---
undress to reply) wrote:
> In article
> <7d997e21-b5be-488e-aa3d-e83551917... at z1g2000vbx.googlegroups.com>, AEF
>
> <spamsink2... 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.
Please tell me where. I don't recall ever seeing anything in the
manuals telling you that you must not double up quotation marks inside
a lexical function being substituted within a quoted string. There is
an example somewhere in the manuals that has an example DCL procedure,
one of whose lines just happens to do this, but nowhere do the manuals
tell you to not double up the quotation marks in this case.
>
> > 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.
Well, perhaps it should have been included at the beginning of User's
Manual 14.12 where it does say that apostrophes force lexical
substitution.
[...]
> > No, this is not documented in the manuals,
>
> Why not?
See below.
>
> > 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.
I guess they never expected anyone to do such a thing (apostrophes
forcing ampersands to perform symbol substitution), or perhaps they
never even considered the possibility themselves! (Well, I suppose the
programmer must have.) Perhaps this is just a trick that never makes
it into the docs. There are many such secret tricks on Mac OS X, and
at least a few in Windows. And then there are the ultra secret tricks
that don't make into websites or books that claim they already have
all the tricks. I found some of these ultra secret tricks on the Mac.
Back to VMS: Does it say anywhere that COPY NL: filename creates a new
file? And there are some other tricks I can look up as examples.
AEF
More information about the Info-vax
mailing list