gir.core icon indicating copy to clipboard operation
gir.core copied to clipboard

Support explict casts for GObject to arbitrary types.

Open badcel opened this issue 1 month ago • 0 comments

If the type resolving chose to create some instance for the user, but the chosen type does not match the requirements of the user (because some interface is needed) there should be some explicit mechanic to allow casting to a desiered type.

  • If the given instance already implements the desired type, just return the instance.
  • If the given instance does not implement the desired type, ask the GObject-Type system if the requirement is met. If so create a helper instance of this type to fullfill the requirement of the user. Otherwise throw an exception.

Keep in mind that in this case there are multiple instances for one pointer in cache!

badcel avatar Nov 24 '25 07:11 badcel