Ah. So you are not talking about Rust as it exists today, but about some other, hypothetical, language that may also exist.
Fair enough, but how is that hypothetical language is relevant to our discussion here?
Is there an RFC or some discussion that seriously propose to extend Rust in that direction?
You assume that you may have your cake and eat it too… but why are you even sure that may work?
Today, in a Rust as it exists today typeid
can ignore lifetimes precisely because Any
have that : 'static
bound.
Internally Any
uses typeid
to distinguish types, but because of that bound we can be sure that types that are different stay different when compared via typeid
.
If you remove : 'static
bound then the question of whether having typeid
that's no longer distinguishes between lifetimes is enough is immediately raised.
But that's the central question of the whole exercise: when language is extended, in some way, the most important part is sequence that connects that extension to the “business need”, something requirement that one may want or need, that's expressible in a layman terms – and then series of decisions that connect your obscure language extensions to these.
Otherwise it's way too easy to invent some busy work with no real benefit. Your proposal, essentially, would make shared references permitted in such Any
type but uniique references illegal. And closures with references would all be receiving 'static
references (which definitely reduces their usability). Is it really the good solution? Is it useful?
We don't know till we would see some concrete examples. Because we start with the requirement that Any: 'static
doesn't work for us and then, immediately, turn around and slap extra : 'static
requirements in a different place… have we actually solved anything? Have we actually made something worthwhile possible… or have we just made language more complicated for no good reason?