I think making instance() return a pointer makes the API worse as now there is (at least semantically) the possibility of that pointer being nullptr. I much prefer to use references for stuff that can't be null as here there is an actual enforcement of this claim and every user can easily see it (whereas for pointers the best you can do is a promise in the documentation of some function).
I think making
instance()
return a pointer makes the API worse as now there is (at least semantically) the possibility of that pointer beingnullptr
. I much prefer to use references for stuff that can't be null as here there is an actual enforcement of this claim and every user can easily see it (whereas for pointers the best you can do is a promise in the documentation of some function).Originally posted by @Krzmbrzl in https://github.com/ValeevGroup/SeQuant/issues/222#issuecomment-2218120202