Separate static name from NativeClass
into new trait
#847
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows NativeScript types to be registered under names only determined
at run time, enabling better ergonomics for libraries.
Ref #601, #603
Unresolved questions
This does not implement the
#[name = "MyCustomName"]
static renaming syntax as suggested in #601 (comment), because it's very uncommon (if at all possible) for a key-value pair to be the top-level meta in an attribute. It should also be noted that at this moment, theNativeClass
macro already utilizes a large number of type-level attributes:inherit
user_data
register_with
no_constructor
...so it might not be wise to add another into the mix, especially under such a non-specific identifier as
name
. We might want to consider bundling (some of) these into a single top-level attribute (likevariant
for theFrom
/ToVariant
macros) instead. See #848.