Proposal: Way to force a struct/type to be distinct/unique #5578
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Background:
A strangeness that @DutchGhost and I found when developing zorrow was that in order to have comptime variables be instanced for a specific struct, we needed to introduce a var to force it to treat that type as unique. Otherwise those type seem to alias to another, causing comptime values to either not matter or not mutate for that type.
The following 3 examples will illustrate what is expected to "just work", the required way to accomplish it and the proposed change to accomplish it.
Expected:
Required:
Proposed:
Summary:
The reason for the
distinct
keyword or something to that effect, is to solve the following problems:uniq
arg on the.give()
, the comptime vartimes
doesn't persist mutationsuniq
arg on theGiveTwice()
, any subsequentGiveTwice
instance aliases to the firstThe text was updated successfully, but these errors were encountered: