proxy module#
Copy-on-Write / Proxy Utility Functions.
The JITX API uses a proxy concept to facilitate memoization, copy-on-write, and for tracking object scene graph entries. It is used to identify objects that are functionally the same, but created in different places of the design, such as a port. A paramtric port is only possible to net to another port object if they share an origin, which functionally means that they share the same underlying instantiated object, and neither has been modified after they’ve been created.
The proxy mechanism is transparent to normal use of JITX, if you find yourself poking around here and you’re not writing some kind of integration or export plugin where you want to determine if two objects have a common base instance, you should probably ask yourself if you’re in the right place.
Note the type(proxy) will be reported as Proxy for a large set of JITX objects. Use typeof from this module instead if you need the true type of an object.
- origin(p)[source]#
Determine the origin of a given object.
If a proxy has not been modified, its origin is the same as the origin of its parent. If a proxy object _has_ been modified, its origin is itself.
This can be useful to check if multiple proxies share and are functionally equivalent to a common ancestor.
If the object is not a proxy, the object itself will be returned, making the function safe to call on any object.
- Return type:
TypeVar(T)- Parameters:
p (
T)