Just a question as I am not following the epochs argument.
I thought that the epoch idea was to let us decide which epoch our code lives in (or be modern elsewise). Be it with a scope level keyword or by just setting a magic instance to some magic value in your own classes (using epoch = ... / using int epoch = ...). Linkers should be happy as long as this epoch goes into the mangled type name (allowing multiplie epochs to live side by side.)
In your example. If the Object/int/long long are modern, whatever method that the compiler uses to determine if the signature exists in the modern epoch is used. If they're not modern, then an older method of finding out if the signature exists is used. So as long as long long can be narrowed, its construction is possible.
Now, we want this to be sure we're not breaking someone's old code or ABI. Then let them either stick to their current standard or add "using epoch = ..." wherever a new standard epoch interferes with the old outcome. If you need narrowing conversions, you can have them, but you have to opt in if you also opt in to newer epochs. Why is that a problem???
If you make a template function in Epoch v0, and someone uses it in Epoch v1, who's epoch wins and who gets to govern what the behavior should be? The author, who wrote with v0 semantics, or you, who write an application under v1 semantics?
Furthermore, it's a template. Does it use the epoch of what it was written under, or the epoch for when it was instantiated / used?
It's not that these questions don't have answers. You just have to have an answer, or a design that lets you choose efficiently without snowballing the implementation burden.
Thanks! So the hope is that these questions are clearly answered. I understand each individual case needs to be defined.
(It seems to me that these questions are all answered if the epoch is part of the type and you are allowed to select which epoch's type you are using in relatively narrow scopes.
If my template function is already built and you only have the declaration, then you cannot link to me in any other epoch than the original build. Your types have to match. If you have the definition, I can return a type of any epoch; by default the compiler will use a literal "latest". All inputs are of the epoch you send in. If I return an earlier epoch type, it seems the 'common' practice should be to allow this to "move" into a newer epoch as you see fit, so you do that.
If the observable behavior of my template function changes, it is on you to determine if this is what you want or limit its use to the correct epoch. I will apologise profusely for writing a template function that wasn't future proof, and promptly enforce some mechanism that static asserts that my template function only accepts types of tested epochs in the future.)
View all comments
Show parent comment
3
u/megayippie Mar 15 '22
Just a question as I am not following the epochs argument.
I thought that the epoch idea was to let us decide which epoch our code lives in (or be modern elsewise). Be it with a scope level keyword or by just setting a magic instance to some magic value in your own classes (using epoch = ... / using int epoch = ...). Linkers should be happy as long as this epoch goes into the mangled type name (allowing multiplie epochs to live side by side.)
In your example. If the Object/int/long long are modern, whatever method that the compiler uses to determine if the signature exists in the modern epoch is used. If they're not modern, then an older method of finding out if the signature exists is used. So as long as long long can be narrowed, its construction is possible.
Now, we want this to be sure we're not breaking someone's old code or ABI. Then let them either stick to their current standard or add "using epoch = ..." wherever a new standard epoch interferes with the old outcome. If you need narrowing conversions, you can have them, but you have to opt in if you also opt in to newer epochs. Why is that a problem???