-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does XRAnchor.detach() imply that the unattached anchor lives on? #34
Comments
The newly detached object is roughly as useful as the anchor whose tracking is forever lost - you could theoretically obtain an XRSpace out of it, but you'd never get a meaningful pose out of it. I'm not sure if we could argue that this makes the object alive in a meaningful way. Additionally, in case of detaching an anchor, I have decided to throw an |
Yea, after you call I do agree with the functional design of having implicit anchor loss from the UA side leave the object functional as a dummy object, to avoid timing issues, but having the object properly go dead if you explicitly call |
Given that we do not really have a way of consuming the object on which a method is called (Rust-style), Some more notes:
I'd say that |
I had initially preferred In C#, there is an explicit pattern for an instance method that releases external resources: |
There's also I still prefer |
Not sure, if this is the right place. But from the spec it was not clear if we can arbitrarily call for "anchor removal" (Section 6) or should we call only within a RAF callback ? |
Destroying things on the web is pretty uncommon. I think This brings up a good point however, disposing of things on the web is typically left to the browser implementation. Even web audio nodes are left up to the implementation to dispose of when they need to be garbage collected. To this end, would it be an option that rather than having to explicitly dispose of an anchor, it can be disposed of by the implementation after all references to it have been deleted? |
I think we don't have to require removal to happen within rAF callback - the implementation can immediately mark the anchor internally as no longer fully functional (to ensure that accessing properties is failing after it was removed) and notify the device as soon as it can.
In general I agree with the approach, but I think this is one of the cases where we should expose a method to proactively mark the object as no longer needed (there is a cost associated with maintaining anchors so the application has a way of reducing such costs early instead of relying on GC). There is also a precedent - the already mentioned |
Agreed on having an explicit method for destroying an anchor synchronously. However, I also agree with @blairmacintyre that the name
detach()
implies to me that this newly-detached object will live in on some meaningful unattached way, when in fact there's no longer anything meaningful you can do with that anchor.I wonder if
destroy()
,drop()
,forget()
or simplystopTracking()
(to align withtrackedAnchors
) makes it more clear when you'd call this method: when you're no longer interested at all in that anchor.I'll make a specific issue for bikeshedding
detach()
so those with more web API experience than me can call out similar cases in other web APIs.Originally posted by @thetuvix in #10 (comment)
The text was updated successfully, but these errors were encountered: