[x3d-public] relaxing requirement for DEF prior to USE

Don Brutzman don.brutzman at gmail.com
Wed Mar 25 17:15:18 PDT 2026


BLUF: review and comment welcome, especially by browser implementers.

"Way back in the day" there was a requirement for DEF labels to precede USE
references.  This was for best performance of scene loading, to permit
single-pass construction of a scene graph, without having to make a second
pass that replaced dangling USE references back to a DEF table (which was
constructed during the first pass).  This was a VRML97-era requirement.

Such a requirement hardly seems necessary with modern parsing and
processing.  There is not such a requirement in HTML or any other XML
languages that I have encountered.

Dick Puk and I have looked at this pretty closely.  Now proposed and
written up in the Mantis issue tracker:

   - Mantis 1526: relaxing requirement for DEF prior to USE - Web3D MantisBT
   <https://mantis.web3d.org/view.php?id=1526>
   - https://mantis.web3d.org/view.php?id=1526

Description Historically defining a DEF name has been required prior
referencing it via corresponding USE name.

Original rationale was based on allowing single-pass parsing of
text-formatted files, in order to maximize parsing performance and minimize
parsing memory requirements. Occasionally this requirement was reaffirmed
over the years.

Modern systems (including hand-held devices) have much greater memory
capacity and computational power. Further, modern parsing libraries are
more efficient. This requirement is fairly unique to X3D/VRML and not a
common prerequisite in other declarative languages based on XML or JSON.

Can the requirement for DEF before USE be relaxed for X3D 4.1?

At a minimum, the specification needs to point out that putting DEF prior
to corresponding USE permits single-pass parsing with higher performance
and possible lower memory requirements.

Also, at a minimum, since it is a historical requirement, the specification
ought to explicitly state whether such ordering is required or not.
Additional Information Where is this requirement? Not found in the
following:

* 4.4.3 DEF/USE semantics
*
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD/Part01/concepts.html
"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 ISO/IEC 19775-2).

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 4.3.5
Transformation hierarchy, for restrictions on self-referential nodes)."

Node names shall be unique in the context within which the associated DEF
name occurs. 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 ISO/IEC 19775-2).

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 4.3.5
Transformation hierarchy, for restrictions on self-referential nodes).

Node names shall be unique in the context within which the associated DEF
name occurs."

 brutzman <https://mantis.web3d.org/view_user_page.php?id=10>


Not found in X3D XML Encoding.
* 4.3.3.1 DEF and USE attribute syntax
*
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19776-1v4.0-WD1/Part01/concepts.html#DEFAndUSEAttributeSyntax

Not found in X3D ClassicVRML Encoding
*4.3.3.1 USE node statement syntax
*
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19776-2v4.0-WD1/Part02/concepts.html#USEStatementSyntax

 brutzman <https://mantis.web3d.org/view_user_page.php?id=10>

 2026-03-25 16:59


Added to 4.4.3 DEF/USE semantics
*
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD/Part01/concepts.html#DEF_USE_Semantics

====
     Any USE node reference without a corresponding DEF, within the scope
of the current scene or prototype declaration, is an error.

     NOTE  DEF names are not required to precede USE references.
====

TODO confirm no mention of such a "DEF before USE" requirement in X3D
Compressed Binary Encoding (CBE)

If anyone thinks such a requirement is needed, please holler.  Extra credit
if you find that original requirement.

Thanks for considering the possibilities.  Have fun with X3D!  😀

all the best, Don
-- 
X3D Graphics, Maritime Robotics, Distributed Simulation
Relative Motion Consulting  https://RelativeMotion.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20260325/583fe600/attachment.html>


More information about the x3d-public mailing list