Hey everyone, this is a spinoff/tangent of the Struct Extensions Proposal thread, to talk about an intermediate short-term variant of the feature that I’m starting implementing now, that won’t cut off any of our eventual decisions in that thread.
This is a behind-the-scenes peek at how I’m interleaving implementation and design for this one, just for transparency and because talking implementation is fun. No final decisions are made here, and this temporary implementation doesn’t affect anything about the final design of struct extensions (if it seems like it is, I’ll back off implementation and rethink).
In other words, I have two goals I’m working on:
* Short-term (this thread): Figure out a “conservative min-viable-product” that I can start implementing now, which doesn’t cut off any long-term options.
* Long-term (main proposal thread): Figure out the final design.
Anyway, this is my interpretation of a conservative min-viable-product that I can start implementing:
* Decision 1 (“Where can conforming extensions be?”): I think option B (“Either in the struct’s file or the trait’s file.”) is good for now and we can consider separately whether to expand that to “the struct’s package or the trait’s package” or go even further.
* Decision 2 (“Should we allow non-conforming extensions?”): Option C (“Conservatively start with option B, reevaluate later.”) lets do that.
* Decision 3 (“Where can non-conforming extensions be?”) would be moot for now if we do Decision 2 Option C.
* Decision 4 (“What can be in an extension?”) proposal remains the same
* Decision 5 (“Handling conflicts”) proposal remains the same
* Decision 6 (“Are extensions automatically imported?”) conservative option is actually Option A, will do that for now.
* Decision 7 (“Need import extension?”) remains the same, don’t want it.
* Decision 8 (“What if we import only an extension but not its target struct?”) is moot now because importing it is explicit.
* Decision 9 (“Support importing multiple extensions?”) remains the same, yes.
* Decision 10 (“Proposed Syntax”). Syntax is easy to change. I might call it `__extension` for now though, so people don’t think it’s the final syntax.
* Decision 11 (new, “What decorators can be on extensions’ methods”) I’ll conservatively disallow all decorators for now.
If anyone has any questions or thoughts on this temporary implementation, let me know in this thread!