[x3d-public] Write-up for Don, X3DJSONLD v2 for SAI, not DOM

John Carlson yottzumm at gmail.com
Mon Jan 23 21:52:13 PST 2023


Re:  synthesized app examples for ECMAScript 6 and VRMLScript; X3DJSONLD v2
for SAI.

https://raw.githubusercontent.com/coderextreme/X3DJSONLD/master/src/main/node/net/ecma/data/JinLOA4.mjs

Here’s what I’d like to do:

1) Write a script to translate “new …” to JSON.  Wrap property names in
strings like JSON.   Add @, #, - in front of keys as required by JSON
(JavaScript will choke on these).

2) convert JSON property names to standard SAI (createNode…a factory
method)!

That way, we can pass both JSON and ECMAScript to the same or similar
processor…potentially X3DJSONLD.   Or X3DJSONLD built on top of JavaScript
SAI (with a new name, so I don’t get confused).  X3DJSONLD really has
little relationship to JSON anyway, we only use JSON for preprocessing into
objects and values (potentially with JSON data structures in non-native
JSON)

And at the same time, use the .mjs files as JavaScript programs, no DOM
intended.

Here’s also an attempt in X_ITE’s VRMLscript, that is more in line with
standard SAI:

https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/vrml/net/coderextreme/data/JinLOA4.js

I’m not saying this works yet, I’m looking for feedback.

For  VRMLscript, we could use proxies for validation.   This is what
discombobulates me.   I’d like to use a setAttribute() method on the
instances instead, for full encapsulation.  I’m guessing Andreas’ DOM
addition for X_ITE has been fully incorporated?   I think adding get and
set (ES6?) methods may avoid proxies and/or lots of inline validation.

For me, it’s a lot easier to synthesize a lot of examples than write one by
hand.  I realize we need to specify such things, and the synthesizer goes
into a test suite.   Plus it gives us copy/paste features into the standard.

If you’d like me to create a private repo to discuss such things, let me
know.

I guess what I’m trying to say is, we can use X3D JSON and a new version of
X3DJSONLD.js built around SAI, not DOM.

Thanks to Don to leading me in this direction,  I’m not sure I got where I
wanted to go!  The gist of it is: 1) if necessary, create a new module
converting JavaScript SAI to JSON 2) write a new module which takes JSON
and creates an SAI scene.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230123/da1d6036/attachment.html>


More information about the x3d-public mailing list