You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a very real sense, when you expose a function via pg_extern, you are making it public in every way that really matters: it is now a callable symbol in the binary with a predictable name! Admittedly, it is using a different ABI, so if we were truly writing these in Rust, they might be written
( And we might be able to have people write that if we wanted, too, but we would have to consume the extern "Postgres" before rustc can complain about it. )
The real problem is that every proposed Rust compile-time reflection scheme I have seen, and even several macro-based solutions for problems in pgrx like schema generation, either inherently respects privacy or tends to respect it. So I have begun thinking that perhaps we should require these fn to be pub, so that we can use those solutions in the future (see also #1468).
However, this is a change that is likely to break a lot of code. Accordingly, it would be... extremely rude to land this outright. If this is done, it has to be incremental, with a deprecation warning first.
Even landing the deprecation warning, however, should not happen until 0.13, for two reasons:
0.12 is going to keep people busy enough fixing code due to the lifetime fixes.
This needs more time to be thought over, for other considerations. For instance, the real problem is arguably that the arguments and return types are public information at this point: if these fn were written using their own real ABI string like above, then calling a private function would be fine, but using a non-public return type would cause reachability problems, so perhaps we want to do something more complicated and more precise?
The text was updated successfully, but these errors were encountered:
In a very real sense, when you expose a function via
pg_extern
, you are making it public in every way that really matters: it is now a callable symbol in the binary with a predictable name! Admittedly, it is using a different ABI, so if we were truly writing these in Rust, they might be written( And we might be able to have people write that if we wanted, too, but we would have to consume the
extern "Postgres"
before rustc can complain about it. )The real problem is that every proposed Rust compile-time reflection scheme I have seen, and even several macro-based solutions for problems in pgrx like schema generation, either inherently respects privacy or tends to respect it. So I have begun thinking that perhaps we should require these fn to be
pub
, so that we can use those solutions in the future (see also #1468).However, this is a change that is likely to break a lot of code. Accordingly, it would be... extremely rude to land this outright. If this is done, it has to be incremental, with a deprecation warning first.
Even landing the deprecation warning, however, should not happen until 0.13, for two reasons:
The text was updated successfully, but these errors were encountered: