[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] question regarding PIC and variable scoping
From: |
karan bhatia |
Subject: |
Re: [Groff] question regarding PIC and variable scoping |
Date: |
Sun, 13 Feb 2000 12:02:10 -0800 |
>"But according to the documentation, variable scoping works like object
>scoping" -- according to what documentation?
I'm interpreting the documentation that you yourself quote:
>The nearest I can find anywhere is the following quote from Eric Raymond's
>"Making Pictures with GNU Pic" where (Section 10.2) it says:
>
> "Blocks are also a variable-scoping mechanism, like a groff(1)
> environment. All variable assignments done inside a block are
> undone at the end of it. To get at values within a block,
> write a [sic] name of the block followed by a dot, followed by the
> variable or label you want. For example, we could refer to the
> center of the box in the above composite as last [].Caption
> or A.Caption."
Doesn't this (and the example of last [].Caption) imply that i can get
do the same for variables defined within the last []? "followed
by the _variable_ or label you want".
>None of this contradicts what I've said above except for the words
>"variable or". There is no other reference in Raymond's document
>to accessing internal variables of a block; and indeed the statement
>that a variable assignment is undone at the end of a block would
>imply that it is inaccessible. The example he gives is of course
>a label ("Caption").
I think we agree that the above reference implies that i can do
something like last [].variable. This is exactly the documentation
i was refering to. So either the documentation should clarify
this important distinction between variables and labels (and take
out "variable or") or perhaps there is a way to add that functionality?
So perhaps this is not a bug, perhaps i can make this into a
feature request. Is this a difficult feature to add?
>NOTE that in your example above (P.Q.x) the "x" is not a variable;
>".x" is a built-in name for the x-coordinate of a point, so that
>"P.Q.x" is the x-xoordinate of the centre of the object named Q
>within the object named P. It might be that this is the sort of
>"variable" that Raymond meant in the above quotation.
This is another important point that should be clarified in raymond's
documentation.
thanks,
- karan