Open
Description
The current function pointer types have some downsides:
- They assume that all functions are static code that lives forever. This isn't true for JITs or DLLs.
- They are always non-nullable, safe pointers. This may not be what you want -- particularly the nullable aspect. This is connected to the previous point, because it implies that there is no place to attach a lifetime in the current syntax.
This is a "postponement issue". There have been various RFCs aiming to improve this:
- Function pointer lifetimes #252 -- a fairly straight-forward scheme to add lifetimes to
fn
types. - Make function pointer types look like borrowed pointer types for forwards compatability #883 -- a simple scheme to change the syntax of
fn
to&'static fn
for forwards compatibility. - RFC: Function pointers reform #996 -- a more involved scheme which introduced a kind of unsized type.
It should be possible to adapt these schemes backwards compatibly.