softdevteam / grmtools

Rust grammar tool libraries and binaries
Other
518 stars 31 forks source link

RFC: codify unstable api #429

Closed ratmice closed 11 months ago

ratmice commented 11 months ago

This is an RFC for something that I thought of in the #428 pull request, which codifies the notion of unstable traits and function calls.

Using methods similar to those described by the matrix at, using features to selectively lift the restrictions: https://predr.ag/blog/definitive-guide-to-sealed-traits-in-rust/

It migrates the couple of methods that are marked unstable in the documentation to take token values indicating their instability.

There are 2 variations of these,

  1. InternalPublicApi, that are internal, but public by default (used in generated code).
  2. UnstableApi, require a feature to enable their visibility so that functions requiring the unstable token can be called.

The UnstableTrait function/feature is currently unused, but could be useful for #428.

ltratt commented 11 months ago

I think I like it, but I need to get my head around a couple of the implications -- I'll try and get back to you on this soon!

ltratt commented 11 months ago

Please squash.

ratmice commented 11 months ago

Squashed.