<div dir="auto">Perhaps DEF/USE ordering comes from ID/IDREF in XML:</div><div dir="auto"><br></div><div dir="auto">E.g.:</div><div dir="auto"><br></div><div dir="auto"><div style="font-size:inherit"><a href="https://docs.oracle.com/en/applications/jd-edwards/interoperability/9.2.x/eotin/id-idref-support.html" style="font-size:inherit">https://docs.oracle.com/en/applications/jd-edwards/interoperability/9.2.x/eotin/id-idref-support.html</a></div><br></div><div dir="auto">Someone can look up official W3C specifications.  <div style="font-size:inherit"><a href="https://www.w3.org/TR/xmlschema-1/" style="font-size:inherit">https://www.w3.org/TR/xmlschema-1/</a></div></div><div dir="auto"><br></div><div dir="auto">I’m comfortable allowing USE before DEF.  I haven’t analyzed impact yet though.  Since I have no paying customers, f’em, let’s allow USE before DEF.</div><div dir="auto"><br></div><div dir="auto">John</div><div dir="auto"><br><div class="gmail_quote gmail_quote_container" dir="auto"><div dir="ltr" class="gmail_attr">On Fri, May 1, 2026 at 7:53 PM Don Brutzman via x3d-public <<a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">And no ROUTEs to USE nodes. </blockquote><div><br></div><div>Well, sure Joe.  The ROUTE connections listed in fromNode and toNode go to/from that DEF instance, and all of the USE references follow accordingly.</div><div><br></div><div>John, this is not the end of X3D and we are not trying to rewrite history.  The proposed change is for X3D 4.1 draft.  We are not obligated to keep old browsers working perfectly forever (although that has actually worked pretty well).  Rather, we are committed to not losing old models, and this proposed change does not break backwards compatibility when loading X3D models from earlier versions.</div><div><br></div><div>Of note is that it does not seem like the practice of DEF before USE is actually a requirement in our specifications.  I've looked for such a requirement (including in the language bindings) and not found it.  For example:</div><div><ul><li>X3D version 3.3, 

<span style="background-color:rgb(235,235,235);color:rgb(116,116,116)">ISO/IEC IS 19775-1:2013</span><span style="font-size:14.6667px;background-color:rgb(235,235,235);color:rgb(116,116,116)">,</span>  clause 4 Concepts, 4.4.3 DEF/USE semantics</li><li><a href="https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#DEFL_USESemantics" target="_blank">https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#DEFL_USESemantics</a></li></ul><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)" class="gmail_quote"><font size="2" style="color:rgb(0,0,0)"><b>4.4.3 DEF/USE semantics</b><br></font>Node names are limited in scope to a single X3D file, prototype definition, or string submitted to either CreateX3DFromString, CreateX3DFromStream, or CreateX3DFromURL browser service or a construction for SFNodes within a script. The USE statement does not create a copy of the node. Instead, the same node is inserted into the scene graph a second time, resulting in the node having multiple parents (see <a href="https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#Transformationhierarchy" target="_blank">4.3.5 Transformation hierarchy</a>, for restrictions on self-referential nodes).</blockquote><p style="font-family:Verdana,Arial,Helvetica,sans-serif;color:rgb(0,0,0)"></p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Node names shall be unique in the context within which the associated DEF keyword occurs</blockquote><div><br></div><div>(summary: nothing about DEF before USE)</div><div><br></div><div>If someone can go spelunking in prior specs and find it, that will be interesting.  (VRML97 spec perhaps?) </div><div><br></div><div><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(34,34,34)">Have fun with X3D DEF, USE, ROUTE, and animation event passing!  </span>😁<span style="font-family:Arial,Helvetica,sans-serif;color:rgb(34,34,34)"> </span>👉</div><p></p></div></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">all the best, Don</font></div></div></div></div></div><div dir="ltr"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">-- </font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">X3D Graphics, Maritime Robotics, Distributed Simulation</font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">Relative Motion Consulting  <a href="https://RelativeMotion.info" target="_blank" style="font-family:monospace">https://RelativeMotion.info</a></font></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 1, 2026 at 1:54 PM Joe D Williams <<a href="mailto:joedwil@earthlink.net" target="_blank">joedwil@earthlink.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div style="font-family:arial,sans-serif;font-size:12pt;color:rgb(0,0,0)"><p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">> <span style="font-family:"Times New Roman";font-size:medium;white-space:normal;float:none;display:inline;color:rgb(0,0,0)">Good observation.  Prior definition of DEF values should not matter to ROUTEs either.</span>  </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">And no ROUTEs to USE nodes. </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">Thanks,</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">Joe</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>

<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p></div>
<div style="border-left-width:1px;border-left-style:solid;box-sizing:border-box;padding:10px 0px 10px 15px;margin:0px;border-left-color:rgb(170,170,170)">
<p style="line-height:1">-----Original Message-----<br>From: GPU Group <<a href="mailto:gpugroup@gmail.com" target="_blank">gpugroup@gmail.com</a>><br>Sent: May 1, 2026 7:31 AM<br>To: Extensible 3D (X3D) Graphics public discussion <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>Cc: <<a href="mailto:joedwil@earthlink.net" target="_blank">joedwil@earthlink.net</a>>, Don Brutzman <<a href="mailto:don.brutzman@gmail.com" target="_blank">don.brutzman@gmail.com</a>><br>Subject: Re: [x3d-public] X3DJSAIL: Many DEFs with same value</p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<div dir="ltr">" not received any negative technical feedback" 
<div>The methods I can think of for resolving USE before DEF:</div>
<div>a) single-pass parsing with proxies</div>
<div>b) multi-pass parsing</div>
<div>Both have technical issues. </div>
<div>a) single-pass parsing with proxies</div>
<div>- routes would need to carry proxy (node name, field name) tuple until DEF defined, like routing to an Inline IMPORT node</div>
<div>complexities:?  errors -invalid field name, mis-matched field type, no DEF in name scope- wouldn't show up till scene run-time, making tracing errors difficult. Proxy would/could hold the source file line number for tracing to source file, but this would imply multiple USE proxies refering to same DEF, in order to hold a source file line number for each USE. 'compiling' routes on the fly - first time ROUTE is run/fired, and DEF and field pointers found successfully, a flag could be set saying the ROUTE is compiled, and so the (node name, field name) tuple can be ignored/discarded thereafter, until Inline unloaded, Since there's no direct way for a ROUTE to know when an Inline is unloaded, routes would need to recompile on every fire/run - re-testing if the node exists, and if the node exists, but address has changed (Inline unload and reload), then the absolute field address also changes. If proxy refers to a builtin node type, the relative address from node address would remain the same. But what if the node is a ProtoInstance, and Inline url changed, so a different ProtoDeclare with same Instance DEF name inside the Inline but different field order? Then relative field address would/could also change. So in general ROUTES would never compile -- always looking up field by character string name. -- unless an algorithm to cover all cases is developed.</div>
<div>b) multi-pass parsing</div>
<div>- 1st pass: parse ProtoDeclares</div>
<div>- multiple passes: parse DEF nodes: would need to note the name scope (scene or protobody) to go with the DEF (name scope, DEF name, parsed DEF node) </div>
<div>- the parsed DEF node could be complex with fields referring to other USE before DEF, or ProtoInstances, so ProtoDeclares would need to be parsed first, and they would also be per-name-scope. Could there be USE loops, where multiple passes never resolve?</div>
<div>-Doug</div>
<div> </div>
</div>
<br>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Thu, Apr 30, 2026 at 11:38 PM Don Brutzman via x3d-public <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
<div dir="ltr">
<div>Good observation.  Prior definition of DEF values should not matter to ROUTEs either.</div>
<div> </div>
<div>This is a recent change that has not received any negative technical feedback.  Browser support is still catching up.</div>
<div>
<div class="gmail_signature" dir="ltr">
<div dir="ltr">
<div style="color:rgb(34,34,34)"><span style="font-family:monospace"> </span></div>
<div style="color:rgb(34,34,34)"><span style="font-family:monospace">all the best, Don</span></div>
<div style="color:rgb(34,34,34)"><span style="font-family:monospace">-- </span></div>
<div style="color:rgb(34,34,34)"><span style="font-family:monospace">X3D Graphics, Maritime Robotics, Distributed Simulation</span></div>
<div style="color:rgb(34,34,34)"><span style="font-family:monospace">Relative Motion Consulting  <a href="https://RelativeMotion.info" rel="noopener" target="_blank" style="font-family:monospace">https://RelativeMotion.info</a></span></div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div class="gmail_attr" dir="ltr">On Thu, Apr 30, 2026 at 9:41 PM Joe D Williams <<a href="mailto:joedwil@earthlink.net" rel="noopener" target="_blank">joedwil@earthlink.net</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
<div style="font-family:arial,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">From description:</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">> <span style="font-size:12pt;font-family:arial,sans-serif">Note that the actual DEF node name definition</span></p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">Followed by:</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">> <span style="font-family:univers,arial,sans-serif;font-size:medium;white-space:normal;float:none;display:inline;background-color:rgb(255,255,0);color:rgb(0,0,0)">NOTE   DEF names are not required to precede USE references.</span> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">(in the User Code)? </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">Wondering if this rule is any different than for ROUTE connections?</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">Timers and interpolators must appear before Route can reference them. </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">proto definitions before instances. Same for DEF/USE, lthe DEF must appear first or else What gets put in?</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">So, I don't understand that last note. </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">Thanks,</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif">Joe</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<div style="border-left-width:1px;border-left-style:solid;box-sizing:border-box;padding:10px 0px 10px 15px;margin:0px;font-family:arial,sans-serif;border-left-color:rgb(170,170,170)">
<p style="line-height:1;font-family:arial,sans-serif">-----Original Message-----<br>From: Don Brutzman <<a href="mailto:don.brutzman@gmail.com" rel="noopener" target="_blank" style="font-family:arial,sans-serif">don.brutzman@gmail.com</a>><br>Sent: Apr 30, 2026 11:05 AM<br>To: Extensible 3D (X3D) Graphics public discussion <<a href="mailto:x3d-public@web3d.org" rel="noopener" target="_blank" style="font-family:arial,sans-serif">x3d-public@web3d.org</a>><br>Cc: Joe D Williams <<a href="mailto:joedwil@earthlink.net" rel="noopener" target="_blank" style="font-family:arial,sans-serif">joedwil@earthlink.net</a>>, John Carlson <<a href="mailto:yottzumm@gmail.com" rel="noopener" target="_blank" style="font-family:arial,sans-serif">yottzumm@gmail.com</a>><br>Subject: Re: [x3d-public] X3DJSAIL: Many DEFs with same value</p>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
<div dir="ltr" style="font-family:arial,sans-serif">
<div style="font-family:arial,sans-serif">Multiple duplicate DEF names in a single X3D model is a bad practice, for multiple reasons.</div>
<div style="font-family:arial,sans-serif"> </div>
<div style="font-family:arial,sans-serif">I've updated Scene Authoring Hints accordingly, see highlighted text which follows plus additional references.  Hope this helps.</div>
<div style="font-family:arial,sans-serif">
<ul style="font-family:arial,sans-serif">
<li style="font-family:arial,sans-serif">X3D Scene Authoring Hints: Naming Conventions</li>
<li style="font-family:arial,sans-serif"><a href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#NamingConventions" rel="noopener" target="_blank" style="font-family:arial,sans-serif">https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#NamingConventions</a></li>
</ul>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;font-family:arial,sans-serif;border-left-color:rgb(204,204,204)">
<h3 style="font-family:"Times New Roman";color:rgb(0,0,0)"><span style="font-size:small;font-family:"Times New Roman""><a href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#NamingConventions" rel="noopener" target="_blank" style="font-family:"Times New Roman"">🔖</a> <u style="font-family:"Times New Roman""><a id="m_6418606545701784240m_-5604347041175108675m_-301687211207906899m_3408339107120132057gmail-NamingConventions" style="font-family:"Times New Roman""></a>Naming Conventions</u></span></h3>
<p style="font-family:"Times New Roman";line-height:1;color:rgb(0,0,0)">Models are simple representations for some part of reality. Simulations show the behavior of models over time.</p>
<ol style="font-family:"Times New Roman";color:rgb(0,0,0)" type="a">
<li style="font-family:"Times New Roman"">Clarity is essential when naming components to design a meaningful model.</li>
<li style="font-family:"Times New Roman"">Names matter, suggesting how to think about purpose and relationships.</li>
<li style="font-family:"Times New Roman"">These naming conventions are suitable for X3D scenes, XML tagset design, accompanying HTML pages, and corresponding source code written JavaScript/Java/Python/etc.</li>
<li style="font-family:"Times New Roman"">These naming conventions also match the node and field naming conventions found in the <a href="https://www.web3d.org/x3d/progress" rel="noopener" target="_blank" style="font-family:"Times New Roman"">X3D Standards</a> themselves (and elsewhere).</li>
<li style="font-family:"Times New Roman"">Success Metric: when is a name successful?<br>(Ironic) Answer: when no one has to discuss that name any more, it is simply understood.</li>
</ol>
<p style="font-family:"Times New Roman";line-height:1;color:rgb(0,0,0)">Naming conventions are appropriate for file names, DEF node identifiers and USE node references, prototype names, unique IDs, and more.</p>
<p style="font-family:"Times New Roman";line-height:1;color:rgb(0,0,0)">Here is a combined set of guidelines.</p>
<ol style="font-family:"Times New Roman";color:rgb(0,0,0)">
<li style="font-family:"Times New Roman"">Using clear and consistent names for node names and DEF labels greatly improves the clarity of how a scene works.</li>
<li style="font-family:"Times New Roman"">In effect, descriptive names can make the purpose and mechanics of a scene self-documenting.</li>
<li style="font-family:"Times New Roman""><span style="font-family:"Times New Roman";background-color:rgb(255,242,204)">Avoid <a href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#DuplicateDEF" rel="noopener" target="_blank" style="font-family:"Times New Roman"">duplicate DEF</a> identifier naming as a bad practice</span>, even when identical names might seem reasonable when declaring a prototype in a model. The resulting model will fail XML validation, fail semantic query, and not make sense due to unclear definitions.  Bookmarks in X3D Documentation pages will also fail since duplicate paragraph anchors will be present.</li>
</ol>
</blockquote>
<div style="font-family:arial,sans-serif"><span style="font-family:"Times New Roman";color:rgb(0,0,0)">[...]</span></div>
<div style="font-family:arial,sans-serif"> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;font-family:arial,sans-serif;border-left-color:rgb(204,204,204)"><a style="font-family:"Times New Roman";font-size:medium" href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#ProtoDeclare" rel="noopener" target="_blank">🔖</a><span style="font-family:"Times New Roman";font-size:medium;color:rgb(0,0,0)"> </span><strong style="font-family:"Times New Roman";color:rgb(0,0,0)"><a id="m_6418606545701784240m_-5604347041175108675m_-301687211207906899m_3408339107120132057gmail-ProtoDeclare" style="font-family:"Times New Roman""></a>Prototype Declarations</strong><span style="font-family:"Times New Roman";color:rgb(0,0,0)"> define a template for a new node</span>
<ul style="font-family:"Times New Roman";color:rgb(0,0,0)">
<li style="font-family:"Times New Roman"">Follow <a href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#NamingConventions" rel="noopener" target="_blank" style="font-family:"Times New Roman"">Naming Conventions</a> for node and <a href="https://www.web3d.org/x3d/content/X3dTooltips.html#field" rel="noopener" target="_blank" style="font-family:"Times New Roman"">field</a> definitions.</li>
<li style="font-family:"Times New Roman"">Provide useful/safe default initialization values for each field, rather than depending on default field values internal to the <code style="font-family:monospace">ProtoBody</code>.</li>
<li style="font-family:"Times New Roman"">Include annotation tooltips for each field.</li>
<li style="font-family:"Times New Roman"">Avoid copying <code style="font-family:monospace">ProtoDeclare</code> definitions into additional scenes, instead copy <code style="font-family:monospace">ExternProtoDeclare</code>/<code style="font-family:monospace">ProtoInstance</code> definitions.</li>
<li style="font-family:"Times New Roman"">Tooltips for <a href="https://www.web3d.org/x3d/content/X3dTooltips.html#ProtoDeclare" rel="noopener" target="_blank" style="font-family:"Times New Roman""><code style="font-family:monospace">ProtoDeclare</code></a>, <a href="https://www.web3d.org/x3d/content/X3dTooltips.html#ProtoInterface" rel="noopener" target="_blank" style="font-family:"Times New Roman""><code style="font-family:monospace">ProtoInterface</code></a> and <a href="https://www.web3d.org/x3d/content/X3dTooltips.html#ProtoBody" rel="noopener" target="_blank" style="font-family:"Times New Roman""><code style="font-family:monospace">ProtoBody</code></a></li>
<li style="font-family:"Times New Roman""><a id="m_6418606545701784240m_-5604347041175108675m_-301687211207906899m_3408339107120132057gmail-DuplicateDEF" style="font-family:"Times New Roman""></a>Avoid <span style="font-family:"Times New Roman";background-color:rgb(255,242,204)">duplicate DEF names </span>for nodes inside multiple prototype declarations contained in a single file. Although the DEF namespaces contained inside each independent ProtoBody declaration are logically independent from an X3D perspective, duplicate DEF names will provoke XML validation errors regarding duplicate ID names. They can also easily lead to author confusion, providing semantic ambiguity both notionally and if performing Semantic Web Queries in Turtle.</li>
<li style="font-family:"Times New Roman"">X3D Specification clause: <a href="https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/concepts.html#PrototypeSemantics" rel="noopener" target="_blank" style="font-family:"Times New Roman"">Prototype Semantic</a></li>
</ul>
</blockquote>
<div style="font-family:arial,sans-serif">Further discussion can also be found in</div>
<div style="font-family:arial,sans-serif">
<ul style="font-family:arial,sans-serif">
<li style="font-family:arial,sans-serif"><em style="font-family:arial,sans-serif"><a href="https://x3dgraphics.com/" rel="noopener" target="_blank" style="font-family:arial,sans-serif">X3D: Extensible 3D Graphics for Web Authors</a>,</em> Don Brutzman and Leonard Daly, Morgan Kaufmann Publishers, Elsevier, 2007</li>
<li style="font-family:arial,sans-serif"><a href="https://x3dgraphics.com" rel="noopener" target="_blank" style="font-family:arial,sans-serif">https://x3dgraphics.com</a></li>
<li style="font-family:arial,sans-serif">Chapter 3 Grouping Nodes, 2. Concepts, 1.4 DEF and USE (pp 71-72)</li>
</ul>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;font-family:arial,sans-serif;border-left-color:rgb(204,204,204)">2.4. DEF and USE<br>DEF and USE names are the X3D mechanism for efficiently defining and copying a<br>node, multiple nodes, or even groups of nodes. Copied nodes require far less memory<br>and computation because they need only be created once. This efficiency can greatly<br>improve rendering performance when extensively used in large scenes.<br>When a node is given a DEF name, that name is an identification label that is unique<br>in the file. The DEF name must start with a letter and can contain letters, numbers, and<br>the special characters underscore, hyphen, and period. DEF names must not include<br>whitespace or other special characters. Uppercase and lowercase alphabetic characters<br>are considered strictly different; therefore, DEF names are case sensitive.<br>USE names refer back to a node with a DEF name. These references allow faster and<br>more efficient rendering of graphics objects. Note that the actual DEF node name definition<br>must be located in the scene graph before any USE references. This permits X3D<br>browsers to read and load a scene graph in a single pass, avoiding undefined references<br>and thereby yielding faster parsing and loading. This performance boost not only helps<br>when users first load a scene, but is also valuable when further subscenes are loaded<br>within a parent scene. Authors also must be careful with animation of the fields of a DEF<br>node, because this will equally affect all of the USE copies.<br>When authoring large scenes, using descriptive DEF names improves clarity and<br>helps document a model. CamelCaseNaming is a good way to accomplish this: capitalize<br>each word, never use abbreviations, strive for clarity, and be brief but complete.<br>Avoiding underscore characters improves readability, because pretty-print HTML versions<br>of scenes usually hyperlink these names, and underlined hyperlinks hide</blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;font-family:arial,sans-serif;border-left-color:rgb(204,204,204)"> underscore characters from the user. ROUTE statements that connect one node’s field to</blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;font-family:arial,sans-serif;border-left-color:rgb(204,204,204)">another node’s field are much more understandable when the purpose and type of the<br>node are evident in the DEF names themselves. Examples provided with this book strive<br>to provide useful examples of good naming practices. ROUTE connections are covered<br>in Chapter 7, Event Animation and Interpolation.<br>A good rule of thumb is that a proper DEF name can be sensibly used in a sentence.<br>For example, “The fraction_changed field of the SpinningBoxClock TimeSensor node<br>is ROUTED to the set_fraction field of the SpinningBoxInterpolator node.” Although<br>a bit long winded, such sentences provide a clear and sensible explanation for a given<br>behavior.</blockquote>
</div>
<div style="font-family:arial,sans-serif"> </div>
<div style="font-family:arial,sans-serif">Authoritative reference is always X3D Architecture.</div>
<div style="font-family:arial,sans-serif">
<ul style="font-family:arial,sans-serif">
<li style="font-family:arial,sans-serif">X3D Architecture v4.1 draft, clause 4 Concepts, 4.4.3 DEF/USE semantics</li>
<li style="font-family:arial,sans-serif"><a href="https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD/Part01/concepts.html#DEF_USE_Semantics" rel="noopener" target="_blank" style="font-family:arial,sans-serif">https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD/Part01/concepts.html#DEF_USE_Semantics</a></li>
</ul>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;font-family:arial,sans-serif;border-left-color:rgb(204,204,204)">
<h2 style="margin-top:18px;font-family:Verdana,Arial,Helvetica,sans-serif;color:rgb(0,0,0)"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;background-color:yellow" title="Mantis 1526"><span style="font-size:small;font-family:Verdana,Arial,Helvetica,sans-serif">4.4.3 DEF/USE semantics</span></span></h2>
<p style="font-family:Verdana,Arial,Helvetica,sans-serif;line-height:1;color:rgb(0,0,0)">Node DEF names are limited in scope to a single X3D file, prototype definition, or string submitted to either CreateX3DFromString, CreateX3DFromStream, or CreateX3DFromURL X3D browser service (as specified in <a href="https://www.web3d.org/specifications/X3Dv4Draft/references.html#I19775_2" rel="noopener" target="_blank" style="font-family:Verdana,Arial,Helvetica,sans-serif">ISO/IEC 19775-2</a>).</p>
<p style="font-family:Verdana,Arial,Helvetica,sans-serif;line-height:1;color:rgb(0,0,0)">The USE statement does not create a copy of the node identified by a DEF name. Instead, the same node is inserted into the scene graph a second time, resulting in the node having multiple parents (see <a href="https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD/Part01/concepts.html#TransformationHierarchy" rel="noopener" target="_blank" style="font-family:Verdana,Arial,Helvetica,sans-serif">4.3.5 Transformation hierarchy</a>, for restrictions on self-referential nodes).</p>
<p style="font-family:Verdana,Arial,Helvetica,sans-serif;line-height:1;color:rgb(0,0,0)">Node names shall be unique in the context within which the associated DEF name occurs. <span style="font-family:Verdana,Arial,Helvetica,sans-serif;background-color:yellow" title="editorial, Mantis 1526">Any USE node reference without a corresponding DEF, within the scope of the current scene or prototype declaration, is an error.</span></p>
<p style="margin-top:18px;margin-bottom:18px;font-family:univers,arial,sans-serif;line-height:1;color:rgb(0,0,0)"><span style="font-family:univers,arial,sans-serif;background-color:yellow" title="ensure consistent implementations, Mantis 1526">NOTE   DEF names are not required to precede USE references.</span></p>
</blockquote>
</div>
<div style="font-family:arial,sans-serif">Have fun building understandable models with X3D!  😁 👍</div>
<div style="font-family:arial,sans-serif"><span style="font-family:monospace"> </span></div>
<div style="font-family:arial,sans-serif"><span style="font-family:monospace">all the best, Don</span></div>
</div>
<div style="font-family:arial,sans-serif">
<div class="gmail_signature" dir="ltr" style="font-family:arial,sans-serif">
<div dir="ltr" style="font-family:arial,sans-serif">
<div style="font-family:arial,sans-serif;color:rgb(34,34,34)"><span style="font-family:monospace">-- </span></div>
<div style="font-family:arial,sans-serif;color:rgb(34,34,34)"><span style="font-family:monospace">X3D Graphics, Maritime Robotics, Distributed Simulation</span></div>
<div style="font-family:arial,sans-serif;color:rgb(34,34,34)"><span style="font-family:monospace">Relative Motion Consulting  <a href="https://RelativeMotion.info" rel="noopener" target="_blank" style="font-family:monospace">https://RelativeMotion.info</a></span></div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote" style="font-family:arial,sans-serif">
<div class="gmail_attr" dir="ltr" style="font-family:arial,sans-serif">On Thu, Apr 30, 2026 at 3:25 AM John Carlson via x3d-public <<a href="mailto:x3d-public@web3d.org" rel="noopener" target="_blank" style="font-family:arial,sans-serif">x3d-public@web3d.org</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;font-family:arial,sans-serif;border-left-color:rgb(204,204,204)">
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">Summary: to employ multiple DEFs with same value, employ a table per name scope of DEF information in per Java thread java.lang.ThreadLocal memory for encoded output with one DEF per DEF/USE value.  See bolded table description below.</div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">Feel free to forward.</div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">Is many DEFs with same value for<span style="font-size:inherit;font-family:arial,sans-serif"> a scenegraph node being considered in discussions?  Say I want to addChild() the same Shape node several times to different Transforms</span><span style="font-size:inherit;font-family:arial,sans-serif">, and the Shape node or descendants have DEFs in them.  In X3DJ</span><span style="font-size:inherit;font-family:arial,sans-serif">SAIL, of course.   </span><span style="font-size:inherit;font-family:arial,sans-serif">This is easily done in an SAI binding like X3DJSAIL, just use the same variable passed to several addChild() methods.</span></div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">If it is allowed, what comes out in XML?  I am hoping one leading DEF and several USEs for backwards compatibility.  I think Castle has shown that this is doable.</div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">I am not saying VRML, XML, DOM, or HTML should have multiple parents of a child node. If a browser wants to implement a proxy when a DEF/USE appears more than once, they should be free to do that.  (Hint: JavaScript’s Proxy class.) Maybe each mention of a DEF value (second or following) or USE value (any natural number of them) should create a Proxy on setting or adding?</div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">I do think the encodings are doing the right thing, no changes there.  How can we achieve that output and support multiple parents (references or proxies to children) in X3DJSAIL with one DEF node per DEF value <span style="font-size:inherit;font-family:arial,sans-serif">output?</span></div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">I’m particularly wondering for X3DJSAIL.</div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">Do we need proxies, or will table(s) also solve the issue of multiple DEFs, and replace all but the first with USE on output<span style="font-size:inherit;font-family:arial,sans-serif">?  Also perhaps assuming there’s a DEF table per name scope.  How does X3DJSAIL support name scopes? (I’m clueless, currently).  <strong style="font-family:arial,sans-serif">I’m imagining a table with DEF_value, DEF_found, reference_count, DEF_nodes and USE_nodes columns.  Maybe a name_scope and node_type_name as well.</strong>  These table(s) would be initialized when output begins potentially when a name scope is entered, and filled out as the XML is created.   Multiple threads?  The table can be stored in ThreadLocal memory.  Bingo, if it’s still a thing.</span></div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"><span style="font-size:inherit;font-family:arial,sans-serif"> </span></div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"><span style="font-size:inherit;font-family:arial,sans-serif">Please let me know if such a thing is already available.</span></div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"><span style="font-size:inherit;font-family:arial,sans-serif"> </span></div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"><span style="font-size:inherit;font-family:arial,sans-serif">Someone else can solve for X3DPSAIL?</span></div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"><span style="font-size:inherit;font-family:arial,sans-serif"> </span></div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">Will this also handle USE before DEF?</div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif"> </div>
<div dir="auto" style="font-size:inherit;font-family:arial,sans-serif">John</div>
_______________________________________________<br>x3d-public mailing list<br><a href="mailto:x3d-public@web3d.org" rel="noopener" target="_blank" style="font-family:arial,sans-serif">x3d-public@web3d.org</a><br><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noopener noreferrer" target="_blank" style="font-family:arial,sans-serif">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></blockquote>
</div>
</div>
<p style="margin:0.1rem 0px;line-height:1;font-family:arial,sans-serif"> </p>
</div>
must be located in the scene graph before any USE references.</blockquote>
</div>
_______________________________________________<br>x3d-public mailing list<br><a href="mailto:x3d-public@web3d.org" rel="noopener" target="_blank">x3d-public@web3d.org</a><br><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noopener noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></blockquote>
</div>
</div>
</blockquote></div>
_______________________________________________<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>
</blockquote></div></div>