Private struct returned by public fn

But shouldn’t this situation be handled just using private data and functions?

Though it should be noted that this works the same for namable and unnamable types.

Though making your token unnamable (thus requiring the user to use it via making storage impossible) is interesting as a concept. This will be made unsound by existential types though (as then the type could be made namable via having a function that returns it).

2 Likes

Thank you all guys, you satisfied my curiosity. Let me recap:

  • An RFC is already available to have warning lints.
  • Unnameable traits have very nice use cases (I imagine it will be possible to suppress warning lints for them)
  • There are some corner cases in which unnameable structs have a proper use at to date. In theory, with the stabilization of the Never type and the existential types, less cases will be legitimate (if not none at all).

Thank you all again :smile:

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.