Suppose that you want to traverse an object graph in a navigational way, similar to the way we traverse file systems.
For example, imagine you have an object graph that supports this expression:
var x = objName.foo.bar.baz.fieldName
We can encode this data access expression as a path as follows:
"objName/foo/bar/baz/fieldName"
By breaking this path into segments, we can easily traverse an object graph in JavaScript because in addition to the traditional dot notation, it also supports the array access notation: objName["foo"]["bar"]["baz"]["fieldName"]
.
In Java or JVM Scala, we can use reflection to traverse object graphs, but how would you follow these kinds of paths to traverse object graphs of Scala objects in the Scala.js environment?
In other words, given a path similar in form to URIs, how would you walk through Scala.js objects, and fields?