[x3d-public] scoping for proto names ?

Andreas Plesch andreasplesch at gmail.com
Sun Jun 7 13:40:37 PDT 2020


Let's see if I can explain this question clearly.

First the example:

https://github.com/andreasplesch/x3dom/blob/gh-pages/test/functional/proto/castle/proto_nested.x3d


The table2 ProtoBody uses an instance of the leg2 proto. The leg2 proto
declaration is defined outside of the table2 proto declaration name scope.

The expected result is that the table2 proto declaration is able to use the
name 'leg2' to find the leg2 proto definition.

This does not work in my x3dom proto exploration and it took me a while to
realize that the reason is (too?) strict scoping. The leg2 proto definition
occurs outside of the execution context and name scope of the table2 proto.
Therefore it is not visible to the table2 proto.

At first glance this strictness seems not unreasonable, however, all tested
browsers display the scene as expected.

So I am somewhat puzzled. I think what it means is that name scoping does
not apply to the name of Protos given by the name attribute, since the name
of Proto is the name of a node definition. Proto names are possibly global.

One consequence is that two Protos in a scene cannot have the same name.
And I recall that this case is spec'ed to lead to undefined behaviour.

Would it be correct to treat Proto names as global ? To be clear, by Proto
name I refer to the name given by the name attribute, not a DEF name of an
instance.

Thanks for any insight, or pointers to relevant spec. sections, -Andreas

-- 
Andreas Plesch
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200607/b305d283/attachment.html>


More information about the x3d-public mailing list