Skip to content

Commit dfc73d9

Browse files
committed
Edits to drawbacks and alternatives
1 parent 47a25e8 commit dfc73d9

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

text/0000-conservative-impl-trait.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,20 +503,42 @@ so forbidding them in traits seems like the best initial course of action.
503503

504504
> Why should we *not* do this?
505505

506+
## Drawbacks due to the proposal's minimalism
507+
506508
As has been elaborated on above, there are various way this feature could be
507-
extended and combined with the language, so implementing it might
508-
cause issues down the road if limitations or incompatibilities become apparent.
509+
extended and combined with the language, so implementing it might cause issues
510+
down the road if limitations or incompatibilities become apparent. However,
511+
variations of this RFC's proposal have been under discussion for quite a long
512+
time at this point, and this proposal is carefully designed to be
513+
future-compatible with them, while resolving the core issue around transparency.
514+
515+
A drawback of limiting the feature to return type position (and not arguments)
516+
is that it creates a somewhat inconsistent mental model: it forces you to
517+
understand the feature in a highly special-cased way, rather than as a general
518+
way to talk about unknown-but-bounded types in function signatures. This could
519+
be particularly bewildering to newcomers, who must choose between `T: Trait`,
520+
`Box<Trait>`, and `@Trait`, with the latter only usable in one place.
521+
522+
## Drawbacks due to partial transparency
523+
524+
The fact that specialization and OIBITs can "see through" `@Trait` may be
525+
surprising, to the extent that one wants to see `@Trait` as an abstraction
526+
mechanism. However, as the RFC argued in the rationale section, this design is
527+
probably the most consistent with our existing post-specialization abstraction
528+
mechanisms, and lead to the relatively simple story that *privacy* is the way to
529+
achieve hiding in Rust.
509530

510531
# Alternatives
511532
[alternatives]: #alternatives
512533

513534
> What other designs have been considered? What is the impact of not doing this?
514535

515-
See the links in the motivation section for a more detailed analysis.
536+
See the links in the motivation section for detailed analysis that we won't
537+
repeat here.
516538

517539
But basically, without this feature certain things remain hard or impossible to do
518540
in Rust, like returning a efficiently usable type parametricised by
519-
types private to a function body, for example a iterator adapter containing a closure.
541+
types private to a function body, for example an iterator adapter containing a closure.
520542

521543
# Unresolved questions
522544
[unresolved]: #unresolved-questions

0 commit comments

Comments
 (0)