<div dir="ltr"><div>Hi Don,</div><div><br></div><div>thanks for tracing this.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 8, 2020 at 2:42 AM Don Brutzman <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Next comes prototype declaration Leg2 which has global scope.<br></blockquote><div><br></div><div>Yes, Leg2 has the scope of the main scene.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Next comes prototype declaration Table2 which has global scope, and which can utilize prototype instances of Leg2 because Leg2 was defined previously (and not hidden within nested scope).<br></blockquote><div><br></div><div>This is what I was not sure about. Leg2 was defined previously but not inside the scope of the Table2 definition. The Table2 definition has its own name scope so they are no conflicts of Table2 internal DEF/USE/Routes with DEF/USE names of other prototypes or the main scene.</div><div><br></div><div>But Leg2 is still available. I think it means that higher or global name scopes are included in a ProtoDeclaration for Proto names purposes but not for DEF/USE purposes.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Similar scoping issues for a player can of course occur with Inline, and ExternProtoDeclare, so a browser has to keep track of name scope throughout each of these mechanisms.  This is especially important since authors may be composing diverse models via Inline and ExternProtoDeclare without any knowledge of each others DEF and prototype names.<br></blockquote><div><br></div><div>Let's cross this bridge when the time comes.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
So prototype scoping may seem complex, but actually it is quite similar to Inline scoping so common approaches are likely OK to be used similarly.  Authors can also think of them in the same way.  Good luck!<br></blockquote><div><br></div><div>Yes, I thought, there should be an IMPORT/EXPORT for protos as well.</div><div><br></div><div>Thanks again, -Andreas</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
v/r Don<br>
<br>
<br>
On 6/7/2020 1:40 PM, Andreas Plesch wrote:<br>
> Let's see if I can explain this question clearly.<br>
> <br>
> First the example:<br>
> <br>
> <a href="https://github.com/andreasplesch/x3dom/blob/gh-pages/test/functional/proto/castle/proto_nested.x3d" rel="noreferrer" target="_blank">https://github.com/andreasplesch/x3dom/blob/gh-pages/test/functional/proto/castle/proto_nested.x3d</a><br>
> <br>
> The table2 ProtoBody uses an instance of the leg2 proto. The leg2 proto declaration is defined outside of the table2 proto declaration name scope.<br>
> <br>
> The expected result is that the table2 proto declaration is able to use the name 'leg2' to find the leg2 proto definition.<br>
> <br>
> 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.<br>
> <br>
> At first glance this strictness seems not unreasonable, however, all tested browsers display the scene as expected.<br>
> <br>
> 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.<br>
> <br>
> 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.<br>
> <br>
> 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.<br>
> <br>
> Thanks for any insight, or pointers to relevant spec. sections, -Andreas<br>
> <br>
> -- <br>
> Andreas Plesch<br>
> Waltham, MA 02453<br>
> <br>
> _______________________________________________<br>
> x3d-public mailing list<br>
> <a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
> <a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
> <br>
<br>
all the best, Don<br>
-- <br>
Don Brutzman  Naval Postgraduate School, Code USW/Br       <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><br>
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149<br>
X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman" rel="noreferrer" target="_blank">http://faculty.nps.edu/brutzman</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Andreas Plesch<br>Waltham, MA 02453</div></div></div></div>