microsoft / Trieste

A term rewriting system for experimental programming language development.
MIT License
37 stars 20 forks source link

Make parent() return a Node #129

Closed fhackett closed 2 weeks ago

fhackett commented 1 month ago

Based on a recent discussion that was left out of scope of #128, there was an idea to make ->parent() return a Node rather than require callers to use shared_from_this (or intrusive_ptr_from_this now).

This PR makes that change. It:

Point of discussion: what do we do with original calls to parent? Do all those calls in YAML change type, or do we make them parent_unsafe? I'm told it might have performance implications. So far, I only made ->parent()->intrusive_ptr_from_this() into ->parent() and otherwise went the unsafe route, but there's plenty of room for "don't care keep it simple" in other cases.

There's also a quick fix here for the test cases breaking in dependent projects, since this whole conversation is part of updating rego-cpp's dependencies. If this takes too long I can split that out. Moved to another PR