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

GPU Group gpugroup at gmail.com
Thu Mar 26 10:14:24 PDT 2026


The change -to un-ordered DEF and USE- would break old/current/<4.0 freewrl
parsing. Freewrl uses MFNode / children lists holding only 64bit node
addresses.
The concept of proxies --used/mentioned (by X_ITE?) for programming against
unloaded/future-loaded Inline content-- in theory could be extended in a
new/future/4.1+ freewrl version so all nodes are wrapped by a(n initially
empty) proxy that's DEF/USE associated. Then programming -routing,
scripting declarations- can be done against the (possibly empty) proxies
early in scope of a one-pass parser, and DEFed / allocated specific
node content later in the scope, before the scene starts to run. Runtime
code could check for empty proxies --which may occur for other reasons such
as when a Script deletes a node, there's a 'clean up' of all routing and
other script references, and simply leaving the small proxy in place with a
deletion/empty flag could avoid crashes.
Not sure about old scenes that assume a second (same) DEF name in same
scope would produce a new (DEF name, node) tuple for later scene lookups,
haven't thought about that.
-Doug


On Wed, Mar 25, 2026 at 6:16 PM Don Brutzman via x3d-public <
x3d-public at web3d.org> wrote:

> 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
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20260326/27cc9df5/attachment-0001.html>


More information about the x3d-public mailing list